Slack and Salesforce Integration – Part 2

In my previous post, I demonstrated how to access Slack from Salesforce. I shared an example showing how to use Slack Webhooks and ProcessBuilder to automatically post messages to Slack channels when specific events happen in Salesforce (for example, when the status of an opportunity changes).

In this post, I cover the other side of the integration. I’ll demonstrate how to access Salesforce from Slack using Slash Commands. As an example of this integration scenario, I’ll share three Slash commands:

  • /pipeline [number to show]: Show the top Salesforce opportunities in the Slack UI
  • /contact [searchkey]: Search contacts by name from the Slack UI
  • /case [subject:description]: Create a case from the Slack UI

Watch the video below to see these commands in action in Slack:

/pipeline and /case are “in channel” commands: the response is visible to all members of the channel. /contact is “ephemeral”: the response is only visible to the user that issued the command .


To perform this integration, I wrote a lightweight Node.js app that acts as a message broker between Slack and Salesforce. When the Node.js application receives a request from Slack, it checks whether the token provided with the request is valid: if it matches the Slack token (generated when the slash command was created), a REST service is invoked to perform the requested action in Salesforce. If the token is not valid, an error is returned to the Slack client.

Follow the steps below to install this integration in your own environment:

Step 1: Create the Slash Commands

In Slack, create the three Slash Commands defines as follows:

Command URL Method Custom Name
/pipeline POST Top Opportunities
/contact POST Salesforce Contacts
/case POST Salesforce cases
You can change the URLs later if you are not sure what your app name will be. The important thing at this point is to generate the token for each command.

Step 2: Deploy your Instance of the Node.js App

The easiest way to deploy your instance of the Node.js App is to click Deploy to Heroku button, and fill in the deployment wizard. You need to provide the username and password of an integration user in Salesforce. If you are testing this in a Developer Edition, you can enter your own credentials. For each command, you also need to provide the token generated when you created the command in Step 1.

  1. Make sure you are logged in to the Heroku Dashboard
  2. Click the Button below to deploy the application on Heroku.


Your own instance of the application is automatically deployed.

Make sure you understand the security implications before deploying the application in a production environment

Source Code

The source code for the Node.js application is available in this repository.

46 Responses to Slack and Salesforce Integration – Part 2

  1. agario March 8, 2016 at 10:07 pm #

    good of nice bloge

  2. dan March 10, 2016 at 3:01 pm #

    Thanks Christophe, this is great stuff.

    Quick question regarding the client secret in heroku- can you offer some guidance around setting up the new app from Salesforce? Not sure what I should be building in order to generate a new client secret.

  3. resim kursu March 28, 2016 at 4:08 pm #

    En güzel ortamda en güzel eğitimler en kaliteli hocalar ile en’lerin kulubu olan ruyaavcısı ekibi ile gerçekleştirilmektedir. Güzel sanatlara hazırlıkta bir numaralı adresiniz olan kurumumuz mezun ettiği öğrencilerden aldığı olumlu sonuçlar ve çevrelerindeki yönlendirmeler ile bizlere en çok referans olan şahıslardır. Atölyemizi incelemek için size bir telefon kadar yakınız. İster Avcılar isterseniz Esenyurt iki şubemiz ile haftanın yedi iş günü sizlere hizmet vermekteyiz. Avcılarda metrobüse yürüme mesafesinde olan resim kursu muz Size bir adım kadar yakın… Bakırköy resim kursu ile kalitenin farkına atölyemizde varacaksınız.

  4. Matthew Evans April 4, 2016 at 7:48 am #

    Great article, why do you use Heroku and not expose a REST apex web service on Salesforce directly? Security, scale, other?

    • Lai Thomas ChangJiang May 29, 2017 at 12:07 am #

      That is the same I am wondering… Can slack command call Apex Rest Webservice directly?

  5. Chandler Anderson May 12, 2016 at 2:07 pm #

    My Heroku log keeps coming up with this:

    2016-05-12T18:03:17.284619+00:00 app[web.1]: TypeError: Cannot read property ‘instance_url’ of undefined
    2016-05-12T18:03:17.284662+00:00 app[web.1]: at Connection._apiRequest (/app/node_modules/nforce/index.js:905:17)
    2016-05-12T18:03:17.284713+00:00 app[web.1]: at IncomingMessage.emit (events.js:179:7)


  6. propchill May 16, 2016 at 8:05 am #

    There are a number of drivers which contribute towards the residential real estate in India; these are highlighted in the illustration below. We have already discussed the housing shortfall which is one of the key drivers; the second most important factor is the Indian diaspora, which tends to get overlooked. If the real estate sector in India is able to initiate some confidence building measures in the coming years, it would go a long way in tapping this huge potential market.

    Real Estate Property In india

  7. Jessica Meyer September 9, 2016 at 2:16 pm #

    I keep receiving an error from Slack that says “Visit this URL to login to Salesforce:” and when I visit that URL, “error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration”

    Having never set something up like this, am I missing something obvious? I added a connected app in salesforce and wasn’t sure what to set the callback URL.

    • John Krech November 3, 2016 at 9:49 am #

      I get the same error – did you ever find a fix?

      • Jessica Meyer November 3, 2016 at 12:58 pm #

        Unfortunately I had to drop the project for awhile, so no, but I’d love to pick it back up after awhile so if you have any updates do share! :)

    • Jaya Prakash Kommu January 3, 2017 at 4:51 pm #

      I got this error when my redirect url in salesforce connected app was incorrect. Check if your call back url in salesforce app is similar to this:

      • rihanna February 2, 2017 at 10:46 am #

        this worked for me! Thanks!

  8. rihanna February 2, 2017 at 10:51 am #

    Is there any way to have a command that searches for cases? Similarly to the /contacts command?

  9. Victor August 30, 2017 at 3:51 pm #

    Is it possible to pass more parameters when using the slash command to create a case? Let’s say I want the case to be associated with with an account and contact when created from slack. Is it possible to enter this parameters from slack?

  10. Anupam Shrivastava December 8, 2017 at 5:04 am #

    Hello there. I am unable to create custom integration on slack so I created an app there and creating slash commands. But I am unable to get any token so what should be copied to Heroku Config Var?

  11. aura April 7, 2018 at 8:39 pm #

    I keep getting the error . “Darn – that slash command didn’t work (error message: `502_service_error`). Manage the command at slash-command-case. ” has anyone encountered this?

  12. tom271 April 12, 2018 at 8:15 am #

    Well written post, in this post you are moving very important issues.

  13. shravya ch June 1, 2018 at 10:59 am #

    Hey, Can i post a message back from private channel into Salesforce with this integration ?

  14. Aycan Demir February 10, 2020 at 2:15 pm #

    islami sohbet
    yabancı sohbet
    islami Chat
    Gabile giriş
    Gabile mobil
    Gabile sohbet
    Gay sohbet
    Gay sohbet
    Sohbet Cinsel
    Gabile mobil
    Cinsel Sohbet
    Gabile chat
    Gabile mobil
    bedava chat
    bilecik sohbet bilecik halkına en iyi sohbet ortami sunulmaktadir..
    alanya sohbet kaliteli sohbet sitemiz sizler içndir
    sakarya sohbet Sakaryanin En iyi Elit Sohbet sitesi sizinledir
    samsun chat Samsun Sohbet farkini ücretsiz sitemizde yaşayin
    webmaster forumu Türkiyenin en iyi webmaster forum sitesine sizlerde davetlisinizdir!
    sohbet bursa Türkiyenin en iyi sohbet bursa sitesine sizlerde davetlisinizdir!
    Van Sohbet Vandaki En iyi Sohbet Sitesi Sizinledir
    Kalbim chat Kalbimdeki En iyi bedava sohbet sitesi
    Gay chat Gaylar ile Bedava Sohbet Ede bilirsiniz
    Tam chat

  15. wheeler williams October 2, 2020 at 2:28 pm #

    The Xfer Serum Crack recordings were created as a wavetable synthesizer called Xfer Serum. This serum has gained so much popularity in a short time.xferrecordsserum

  16. holland kinney October 3, 2020 at 2:05 am #

    Blizzard is back with an action-packed multiplayer FPS. It is called Overwatch Key and within this name, you will be part of a group whose mission is to preserve a planet in war.overwatch

  17. robles conner October 3, 2020 at 2:10 am #

    The Latest AndroRat Keygen is an Android remote administration tool. This is an application that allows users to remotely control digital devices with their smartphones.androrat

  18. wagner peterson October 3, 2020 at 2:13 am #

    Free FL Studio 20 Crack is a powerful music production software. You can also work with all types of music for impressive music production.flstudio

  19. higgins chen October 3, 2020 at 2:26 am #

    The Avast driver update Key is basically known as the fantastic form of stock that provides the PC with a limited set of security features. It was created together with a wide range of software packages.avastdriverupdater

  20. oliver stanley October 3, 2020 at 2:38 am #

    Process Lasso Pro 9.9 Crack is one of the best software that keeps your system up to date and active.processlasso

  21. house owen October 3, 2020 at 2:50 am #

    Express VPN 8.5.3 Crack is the solid programming that gives access to any web-based life, sound, recordings, and other such kinds of media substance from any area of the world with no restriction.expressvpn

  22. kidd melton October 3, 2020 at 3:04 am #

    Smart Driver Updater 5.0.396 Crack is an exceptional application that assumes a significant job while keeping up PC drivers.smartdriverupdate

  23. lancaster raymond October 3, 2020 at 3:19 am #

    Avast Driver Updater Crack 2.5.6 update a driver when it gets important to refresh it. Since it’s a calm tedious to refresh and furthermore dubious on the grounds that we need to look and do some design for it. avastdriverupdater

  24. perry albert October 3, 2020 at 3:36 am #

    Xfer Serum V3b5 Crack is a wave synthesizer from Xfer Records Serum Serial Key. It is an application that is widely accepted in music creation.xferserum

  25. ayers frye October 3, 2020 at 3:51 am #

    PowerISO 7.5 Crack is an incredible CD/DVD/BD picture record preparing device, permitting you to begin, extricate, copy, make, alter, pack, scramble, split and convert ISO documents, and mount ISO documents with an inner drive that is advanced.poweriso

  26. reynolds battle October 3, 2020 at 4:07 am #

    32 Lives Mac Download Crack is a crystal clear 32-bit to 64-bit audio drive and VST crack plug-in adapter. There are no additional windows to open and no additional paths to take.32lives

  27. smallstrick land October 3, 2020 at 4:25 am #

    Free Avast Internet Security Activation Code is a comprehensive security program. It is a security package that protects you from different types of Internet threats.avastinternetsecurity

  28. benson owen October 3, 2020 at 4:46 am #

    Full Download Revo Uninstaller Pro Crack is a useful and valuable application that will help us evacuate and uninstall unwanted programs and threats from our system.revouninstaller

  29. simmons ware October 3, 2020 at 5:16 am #

    Avid Pro Tools 2020.5.0 Crack is a computerized sound workstation planned and dispatched by Avid innovation. These Pro Tools utilized in a wide range for sound chronicle and production purposes.avidprotools

  30. barnes wright October 3, 2020 at 5:27 am #

    Avid Pro Tools 2020.5.0 Crack is a mechanized sound workstation arranged and dispatched by Avid advancement.avidprotools

  31. burges osborn October 3, 2020 at 5:36 am #

    MorphVOX Pro Crack is an amazing online and in-game voice changing software. It is available for Windows (32 and 64 bits) and macOS.morphvoxpro

  32. rowe richard October 3, 2020 at 5:47 am #

    WebcamMax Crack is the product capable of providing smooth tracks to meet the needs of the media. However, it allows you to record the video and also capture the amazing moments.webcammax

  33. charles branch October 3, 2020 at 5:55 am #

    Tally ERP 9 Crack is a very famous and smart software. It is a solution chosen for business management by more than a million people in 140 countries.tallyerp9

  34. alison john October 3, 2020 at 6:10 am #

    Sylenth1 Crack with keygen is the most downloadable software that includes a wide range of powerful tools.sylenth1

  35. nielsen sheppard October 3, 2020 at 6:20 am #

    Denise Noize Crack Free Download is a secret weapon used by many professional manufacturers to improve and test their trucks.denisenoize

  36. lowery hewitt October 3, 2020 at 6:29 am #

    Sylenth1 Crack Full Version Download is a virtual VSTi analog composer that raises the definition of quality and performance to the highest level. sylenth1

  37. yuvaraj singh November 23, 2020 at 5:41 am #

    Thanks for sharing this informative content , Great work
    To crack scrum master interview : Scrum Master Interview Questions

  38. yuvaraj singh December 22, 2020 at 6:12 am #

    Thanks for sharing this informative content
    Leanpitch provides online training in Enterprise agile coaching during this lockdown period everyone can use it wisely.
    Enterprise Agile Coaching

  39. yuvaraj singh January 8, 2021 at 4:15 am #

    Thanks for sharing this informative content .,GREAT WORK
    Leanpitch provides online training in Scrum Master during this lockdown period everyone can use it wisely.
    Join Leanpitch 2 Days CSM Certification Workshop in different cities.

    CSM certification online

    CSM online

    CSM online certification

    Scrum master certification online

    CSM online training


  1. Slack and Salesforce Integration | Christophe Coenraets - January 21, 2016

    […] to Slack” scenario, leaving “Slack to Salesforce” for another post (now available here). As an example, we will create a custom integration that automatically posts a message to the […]

  2. Slack and Salesforce Integration: Authentication | Christophe Coenraets - June 17, 2016

    […] part 2 (Slash Commands) and part 3 (Bots), I used an “integration user” to access Salesforce […]