Salesforce is one of the most popular CRMs used today. In this tutorial we will integrate Salesforce with a local Drupal install in order to access the Salesforce API. This will allow us to map data between Salesforce and Drupal.
Enable SSL Certificate In MAMP
The Salesforce Suite requires an SSL certificate to connect Salesforce with Drupal. Luckily, generating an SSL certificate is easy to do in MAMP.
- First add a new host by clicking the "+" icon. Make sure to enable SSL
- Next, click the SSL tab for the new host your created. Click the Create self-signed certificate button.
- Fill out the prompt with whatever info you wish. You don't need to use real information. Click Generate.
- You'll be prompted to select a destination to save the certificate. I chose to save mine at the root level of my project, but you can save it anywhere.
Disable SSL Warning in Chrome (Optional)
You can now visit your site at https://your-example-site. However, you'll notice that Google Chrome warns you the certificate is not trusted and the connection is not private. Since this is just a local site, this isn't an issue, but it can be really annoying. Follow the steps below to disable the SSL warning in Chrome.
- Click the lock icon in the upper left hand corner of the browser
- Click certificate information
- Click and drag the certificate onto your desktop
- Double click the certificate to open Keychain Access
- Make sure you are in the System section under the Keychains column on the left hand side
- Drag your certificate into this area. You will be prompted to enter your password.
- Enter your password and click Modify Keychain
- Right click the certificate and click Get Info
- Under Trust select Always Trust next to When using this certificate: and close out of the box.
- You'll be prompted to enter your password. Once done, click Update Settings
You're now able to access your site without issue.
Create a Free Salesforce Developer Account
If you don't already have a Salesforce account, you can create a free developer account by following the steps below.
- Go to https://developer.salesforce.com/signup and apply for an account
- Check your email for confirmation, and verify your account
- You can now access your account by going to https://login.salesforce.com/
Install and Enable Salesforce Suite Module
In order to connect your local Drupal install with your Salesforce account, you'll need to install and enable the Salesforce Suite module.
Authenticate Your Salesforce Account With Drupal
In order to authenticate your Salesforce account with Drupal, you need to create a connected app in Salesforce. Follow these steps to create a connected app, and authenticate Salesforce with Drupal.
- Login to your Salesforce account at https://login.salesforce.com/
- Under Build Click Create > Apps
- Then under Connected Apps click New
Fill out the following fields:
- Connected App Name
- API Name
- Contact Email
- Select Enable OAuth Settings
- The Callback URL will be https://your-example-site/salesforce/oauth_callback. Note that you can find this at admin/help/salesforceon your local Drupal install
- Select Perform requests on your behalf at any time and add it to the Selected OAuth Scopes column
- I also needed to add Full access (full) to the Selected OAuth Scopes column
- Save. You'll get a message alerting you that you app will be ready to authenticate within 2-10 minutes.
- In Salesforce under Quick Links click Manage Apps. Then under Connected Apps click the name of the app to see the Consumer Ke y and Secret Key
Back on your local Drupal install go to the Salesforce Authorization page at admin/config/salesforce/authorize
- Add your consumer and secret key
- Under advanced, add the Salesforce endpoint. This will be the domain you see in your address bar when logged into your Salesforce account. In my case it's https://na34.salesforce.com
- Click Authorize and follow the prompts
Now that you've connected Salesforce with Drupal, you're ready to take advantage of the Salesforce API. The Salesforce Suite module comes with additional sub modules to help you sync data with your Drupal site and Salesforce. You can also download the Salesforce Webforms module to add additional features between Salesforce and Drupal.