Slack and Salesforce Integration – Connecting the dots

I have been asked to integrate Salesforce and Slack at my company, so I have decided to document my journey as I embark on the process to share with you admins and developers.

The project started in June of 2017.

From my research I found four approaches you can use to integrate Slack and Salesforce: Webhooks, Slash Commands, Bots and the open API of both Salesforce and Slack.  So you know both Slack and Salesforce have apps to install in both Slack and Salesforce to help with the integration between the two apps.

  1. Webhook with process builder
  2. Slash Commands
  3. Bots
  4. API (Development effort will need custom code)

Updated by our developer Patrick Wang on 11/11/2017

High level of SF Slack integration:
1) SF to Slack
From SF, developer can do a http callout to Slack to query channel/user as well as post message to certain channels. The return body is JSON format so an apex parser class is needed to parse the returned JSON. Putting the callout to a batchable class is recommended to avoid governer limits.

2) Slack to SF
Create a slash comment. Deploy the middleware written in Node.js to Heroku to receive the request from Slack and do authentication and perform REST service call to SF.

Credit to: Patrick Wang