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.

  • Pingback: Slack and Salesforce Integration | Christophe Coenraets()

  • good of nice bloge

  • dan

    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.

  • 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.

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

    • Lai Thomas ChangJiang

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

  • 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)


  • 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

  • Pingback: Slack and Salesforce Integration: Authentication | Christophe Coenraets()

  • Jessica Meyer

    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

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

      • Jessica Meyer

        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

      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

        this worked for me! Thanks!

  • rihanna

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

  • Victor

    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?

  • Anupam Shrivastava

    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?

  • aura

    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?

  • tom271

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

  • shravya ch

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

  • Aycan Demir

    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

  • wheeler williams

    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

  • holland kinney

    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

  • robles conner

    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

  • wagner peterson

    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

  • higgins chen

    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

  • oliver stanley

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

  • house owen

    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

  • kidd melton

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

  • lancaster raymond

    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

  • perry albert

    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

  • ayers frye

    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

  • reynolds battle

    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

  • smallstrick land

    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

  • benson owen

    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

  • simmons ware

    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

  • barnes wright

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

  • burges osborn

    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

  • rowe richard

    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

  • charles branch

    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

  • alison john

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

  • nielsen sheppard

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

  • lowery hewitt

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

  • yuvaraj singh

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

  • yuvaraj singh

    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

  • yuvaraj singh

    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