The Pure Aloe Distributor App is written in Node.js and built to run on Heroku. It is a companion to the Pure Aloe app, built on Salesforce. Using the two apps, you can explore how to integrate decoupled applications with Salesforce via Platform Events.
In the commands below, terms wrapped in *asterisks* signify places where you'll need to replace the dummy text we're providing with values that match your Salesforce DX or Salesforce org setup.
-
Install the Pure Aloe Salesforce application first. See instructions here: https://github.com/trailheadapps/purealoe
-
In Setup > Users, create an integration user that you will use to connect to Salesforce from the Node.js app. Select Salesforce as the license type and System Administrator as the profile.
-
Log in (at least once) as that user via your browser. For scratch orgs, use https://test.salesforce.com as the login URL. For Develper Edition orgs, use https://login.salesforce.com. Choose to not register your phone number.
-
In Setup > Users > Permission Sets, assign your integration user to the purealoe permission set.
-
Create a Connected App in a Developer Edition org (do not use your scratch org).
-
Clone this repository:
git clone https://github.com/trailheadapps/purealoe-distributor cd purealoe-distributor
-
Create a Heroku app and give it a name:
heroku create *your_app_name*
-
Set the Heroku config variables (replace with values from your connected app):
heroku config:set SF_CLIENT_ID=*your_connected_client_id* heroku config:set SF_CLIENT_SECRET=*your_connected_client_secret* heroku config:set SF_USER_NAME=*your_integration_user_name* heroku config:set SF_USER_PASSWORD=*your_integration_user_password* heroku config:set SF_ENVIRONMENT=*your_env_type*
Set SF_ENVIRONMENT to sandbox if using a scratch org, or production if using a Developer Edition.
-
Push the code to your Heroku app:
git push heroku master
or run the application locally:
heroku run:local npm start
Note: If you're using a scratch org for this integration, keep in mind that you'll need to repeat the above steps and re-set your Heroku app's config variables when your scratch org expires.