A simple Node.js application that acts as a Slash Command message broker between Slack and Salesforce.
Watch this video to see the application in action.
Read this blog post for more details.
Follow the instructions below to deploy your own instance of the application:
Step 1: Create a Connected App
If you haven't already done so, follow the steps below to create a Salesforce connected app:
In Salesforce Setup, type Apps in the quick find box, and click the Apps link
In the Connected Apps section, click New, and define the Connected App as follows:
- Connected App Name: MyConnectedApp (or any name you want)
- API Name: MyConnectedApp
- Contact Email: enter your email address
- Enabled OAuth Settings: Checked
- Callback URL: https://myapp.herokuapp.com/oauthcallback (You'll change this later)
- Selected OAuth Scopes: Full Access (full)
- Click Save
Step 2: Deploy the Slash Commands
Make sure you are logged in to the Heroku Dashboard
Click the button below to deploy the Slash Commands on Heroku:
Fill in the config variables as described.
- For SF_CLIENT_ID, enter the Consumer Key of your Salesforce Connected App
- For SF_CLIENT_SECRET, enter the Consumer Secret of your Salesforce Connected App
- For SF_USER_NAME, enter the the username of your Salesforce integration user
- For SF_PASSWORD, enter the the username of your Salesforce integration user
- Leave SLACK_ACCOUNT_TOKEN blank for now.
- Leave SLACK_CONTACT_TOKEN blank for now.
- Leave SLACK_OPPORTUNITY_TOKEN blank for now.
- Leave SLACK_CASE_TOKEN blank for now.
- Leave SLACK_WHOAMI_TOKEN blank for now.
Once your app is deployed, go back to the Connected App in Salesforce, and change the OAuth callback URL: Use the URL of your actuall Heroku app, followd by /oauthcallback. For example: https://mynewapp.herokuapp.com/oauthcallback
Step 3: Create the Slash Commands in Slack
In a browser, go to the custom integration page for your Slack team. For example
YOUR_TEAM_NAMEwith your actual team name.
Click Slash Commands, and click Add Configuration
In the Choose a Command input field, type /pipeline and click Add Slash Command Integration
In the Integration Settings section:
- Command: /pipeline
- URL: the URL of the app you deployed on Heroku followed by /pipeline. For example:
- Method: POST
- Copy the token, open another browser tab, login to the Heroku Dashboard, and set the Heroku SLACK_OPPORTUNITY_TOKEN config variable to the value of that token (Setting>Reveal Config Vars)
- Customize Name: Salesforce Opportunities
Click Save Integration.
Repeat these steps to create another Slash command called /account, calling
https://your-heroku-app.herokuapp.com/account. In the Heroku dashboard, set the SLACK_ACCOUNT_TOKEN config var to the value of the token that was generated in Slack.
Repeat these steps to create another Slash command called /contact, calling
https://your-heroku-app.herokuapp.com/contact. In the Heroku dashboard, set the SLACK_CONTACT_TOKEN config var to the value of the token that was generated in Slack.
Repeat these steps to create another Slash command called /case, calling
https://your-heroku-app.herokuapp.com/case. In the Heroku dashboard, set the SLACK_CASE_TOKEN config var to the value of the token that was generated in Slack.
Repeat these steps to create another Slash command called /whoami, calling
https://your-heroku-app.herokuapp.com/whoami. In the Heroku dashboard, set the SLACK_WHOAMI_TOKEN config var to the value of the token that was generated in Slack.