Heroku to Salesforce using NodeJs


Heroku Connect makes it easy for you to build Heroku apps that share data with your Salesforce deployment. Using bi-directional synchronization between Salesforce and Heroku Postgres, Heroku Connect unifies the data in your Postgres database with the contacts, accounts and other custom objects in the Salesforce database. Easily configured with a point and click UI, it’s simple to get the service up and running in minutes – no coding or complex configuration is required.

Login with your Salesforce Credentials

  1. Go to login/test.salesforce.com.
  2. Select Setup from the HomePage (In case if you couldn’t find it click on the name and then you will find the setup option).
  3. On the right side in the quick search box enter Object and click the objects.
  4. A list of existing objects appears.  Then click on the new object and a window appears below.
  5. Enter the appropriate label name and the plural name. A Standard field can be created either data Type – Name or auto-number.
  6. At the bottom select the “Launch new custom wizard Tab after saving the custom object”.
  7. Click on next and choose a tab style for the object and save the object.
  8. After saving the object a detail page appears for the object created.

To create fields for that object

  1. Select NEW from the  Custom fields & relationship.

Choose the required Data type  and create the field by clicking next and save button.

Creating Salesforce Connected App

      To create a connected app in Salesforce

  1. Setup→Create→ App→ Connected App→ new.
  2. Give a name to the app and the contact mail ID.
  3. Select “Enable OAuth settings” checkbox and give a setback URL.
  4. In Selected OAuth scopes choose “Full Access”.


Create an account in GitHub (https://github.com/), create a repository and select as a public repository

  1. Download the GitHub desktop app https://desktop.github.com/  and install the app and open when it’s done.
  2. Click on the cloned repository and add the URL of the repository you created (paste the HTTP link of the repository).
  3. The clone of the repository is created locally (Documents/GitHub/repository_name).
  4. Move the folders to the repository which are to be added to GitHub and once you paste the code you can see the files in the GitHub Application.
  5. Provide a valid message for the files to be uploaded.

Click commit to master and at the top you need to press the push button to commit to GitHub.

This is my Github URL:



Create an account in Heroku and create an app and open it.

Click on the resources tab and in the Add-ons input  add both.

  1. Heroku Postgres
  2. Heroku Connect

Click on the Heroku Postgres , you will see the table size, number of rows in overView tab.

And select Heroku Postgres → settings, you can see the Database credentials .

Config Variables for adding Salesforce Org details

From App → Settings → Config variables→ Reveal config variables

Add the salesforce credentials like

  1. Consumer key
  2. Secret key
  3. Call back URL
  4. Database URI
  5. Org Id
  6. Password+SecurityToken


Add NodeJs as a BuildPack

How to connect GitHub and Heroku

  1. App→ Deploy → Deployment Method
  2. Once you logged in to your Github account.
  3. Select the GitHub and give access then the select the search button and the list of repository appears then select what was created earlier.
  4. To automatically deploy the changes in the GitHub to Heroku database select “enable automatic deploys”
  5. In case if automatic deploy is not enabled to validate the code, then mannual deploy should be selected every time the code is changed or committed to GitHub. (For this we need CI automation.)
  6. Local repository → GitHub (push) → Heroku(automatic or manual deploy).

Open the NodeJs folder  

  1. Open in sublime text→ server→ config → database.js
  2. Enter the Postgres database credentials in the Database.js file.
  3. Open in sublime text→ server→ config → routes.js
  4. For build your URL , accessing your postgres database and salesforce org.

Creating a table in your Postgres Database

  1. In command prompt type → NPM install PSQL
  2. In PC→ properties → Advanced system settings→ environment variables→ path → edit → add→ C:\Program          Files\PostgreSQL\<version-number>\bin (in both user variables and system variables).
  3. Login with Heroku → Heroku login
  4. Enter login credentials (logged in  as username message appears )
  5. Paste the Postgres Database URL .

You’re all set! Now you can use heroku and salesforce using NodeJs

Scroll to Top