Back to blog home page

Integrate Your Backand App with Salesforce to Leverage Customer Data

Posted by on Apr 13, 2017

Building and maintaining customer relationships is crucial for driving sales to your platform. However, it can also be a complex process requiring integrating data from multiple sources and, more importantly, ensuring that data is accessible when it is needed. In this article, we’ll look at integrating a Backand application with the popular Salesforce CRM platform, providing you with all of the tools you need to effectively leverage your customer data in your Backand application.

In our next post, we’ll be discussing similar integration with the SalesforceIQ product.

Use Cases for Custom Integrations with Salesforce CRM

Salesforce CRM is a powerful tool, and it needs data streams to thrive and bring value to an organization. With Backand, you can integrate Salesforce CRM into your organization’s tech stack, allowing your sales organization to more effectively leverage your leads. Below are a few examples of use-cases that can leverage Backand to drive an integration with Salesforce CRM:

  • You can use real-time communications to push notifications to your sales people via your mobile app
  • You can integrate with other internal systems, like HR, Ops, or internal tracking and monitoring
  • You can use with a custom database, to increase productivity by easily consolidating all of your relevant customer data into a single location
  • You can integrate with customer-facing applications, collecting and updating data from sales leads in real time

Connecting to Salesforce CRM

Integrating Backand and Salesforce CRM is as simple as leveraging the full-featured REST API provided by Salesforce from within your Backand application. While traditionally you’d need to make these calls to the API from a server, you can achieve the same functionality in Backand by using our custom template action. This action provides an easy-to-use code template for making calls to the Salesforce REST API, letting you update your user tracking data based upon user activity in your Backand app, or even update your Backand app’s UI based upon what you know about your user in Salesforce.

The Salesforce CRM Action Template

We have created an action template that will give you jump start with Salesforce CRM. You can either trigger this action with an object’s CRUD event handler, or call it on-demand from your client code. The following is the content of the ready action template call
Salesforce CRM under the CRM & ERP section:

The above code fetches the access token every time you call the action. You can improve the performance of this call by caching the token into a Backand Server-Side Cookie, and only performing the retrieval when the token has expired.

Setup access and get client and secret keys

Follow these steps to obtain your Salesforce CRM authentication information:

  1. Sign in to Salesforce CRM as a user with Admin rights
  2. Open Setup, found under the gear icon
  3. Open App Manager
  4. Click on New Connected App
  5. Provide Connected App Name, API Name, and Contact Email
  6. Check Enable OAuth Settings
    1. Check Enable for Device Flow
    2. Under Selected OAuth Scopes, select Full Access (or any other permissions you need)
  7. Click Save
  8. Copy Consumer Key into the client variable in the code
  9. Copy Consumer Secret into the secret variable in the code

Once you’ve obtained the consumer key and the consumer secret, you’ll need to enable server-side security in Salesforce. To do so, follow these steps:

  1. From App Manager, select your new App and Click Manage
  2. Click Edit Policies
  3. Change IP Relaxation to Relax IP Restriction, or add Backand’s IP to your organization’s IP restrictions
  4. Change Timeout Value to 24 hours
  5. Click Save

With that completed, you should now have full access to your CRM objects using the Salesforce REST API.

Setup client-side code

Once you’ve configured the action to connect to Salesforce, you’ll need to call the action from your client-side code. To do so, use the following JavaScript to construct a GET request and trigger your Salesforce action:

Simply replace ‘your object name’ with the object that contains your Salesforce custom action, and replace ‘your action name’ with the name of the action that you provided while creating the integration.

With these changes, you’re now able to pull in any and all Salesforce accounts available via their API! You can use a similar pattern to construct additional calls to the Salesforce API – simply replace the URL and parameters in the custom SalesforceCRM action with the URL and parameters for the object you want to retrieve.

Adapting for AWS Lambda

For operations that have significant security concerns, or that represent complex business logic centered around an integration with Salesforce, it may benefit you to implement your Salesforce CRM integration as an AWS Lambda function using Backand’s Node.JS AWS Lambda server-side functions. You can even use most of the code we’ve already supplied, we simply need to modify the method we use to send HTTP requests to Salesforce to use a method compatible with Node.JS. Node implements HTTP communications using the ‘http’ module, which will need to be included. Once the module is ready, converting the code above is very straightforward. Take the HTTP request lines, provided below:

And replace these lines with the Node.JS equivalent:

You’ll need to provide a callback function that handles the response data. As the format of this function will depend heavily on your app’s data, we’ve left this blank in this post. You’ll also need to use the same pattern of sending a Node HTTP request when obtaining the accessToken from Salesforce – simply make the appropriate changes to the $http call that obtains the access token, and you are ready to go.


Salesforce, as the world leader in CRM solutions, is used by thousands of companies around the world. This integration guide covered integrating Backand with your Salesforce installation, allowing you access to all of your customer and user insights. By leveraging the instructions above, you can modify your Backand application to interface directly with your organization’s CRM information, giving you true flexibility to provide unique internal and external application experiences without losing any data fidelity.