Create Your Own Custom Slack Integration with Salesforce

Today’s topic is on one of our favorite messaging tool: Slack! Slack has become one of the most popular collaboration platforms for teams. With its simple and intuitive interface, robust APIs, and ability to integrate with other tools, it’s no wonder Slack is being adopted rapidly in organizations big and small. 

Salesforce is the world’s #1 CRM platform, providing sales, service, marketing, and more capabilities to businesses. Salesforce is highly customizable and has a powerful API of its own, making it easy to connect with other apps. 

With Slack and Salesforce integrations, teams can benefit from both platforms – seamless collaboration and productivity combined with CRM power. In this post, we’ll explore reasons to integrate Slack and Salesforce and walk through how to set up integrations using APIs and declarative tools.

If you’re eager to see the end result before delving into the details, here’s the finished product:

Why Integrate Salesforce and Slack?

  • There are several compelling reasons to connect Slack and Salesforce:
  • Improve team collaboration by bringing relevant CRM data into Slack conversations 
  • Create customer-facing Slack bots that can access Salesforce data like support cases
  • Build automated notifications in Slack when key events occur in Salesforce, like closing a big deal
  • Reduce context switching by making it easy to share Salesforce records and data within Slack
  • Centralize team communication and make Salesforce data more accessible to non-Salesforce users

In short, Salesforce and Slack integration supercharges your teams’ productivity and efficiency. Next, we’ll look at some real-world examples.

Business Use Cases for Integrating Slack and Salesforce

Here are just a few ways teams can leverage Slack and Salesforce integrations:

  • Get notifications in Slack when you close a big deal or win a new customer in Salesforce. Celebrate the win with your team!
  • Add Salesforce contacts to Slack conversations for quicker collaboration. Simply @mention the contact in Slack.
  • Sync Slack customer support conversations to associated Salesforce cases. All context in one place.
  • Create a Salesforce lead in Slack and automatically sync it to your CRM. No toggling between apps.
  • Post Salesforce reports, dashboards, and weekly sales figures into a Slack channel—visibility for the whole team.

– Sync Slack reminders and scheduled messages to Salesforce task records. Nothing falls through the cracks.

The use cases are endless. Bottom line – your team will be better aligned and more productive.

Key Advantages of Slack Over Other Messaging Platforms

Slack stands out from collaboration tools like Microsoft Teams, Workplace by Facebook, or even Google Chat due to its broad app integrations and automation capabilities. While you can connect Salesforce to Teams, Workplace or Google Chat, Slack provides a richer experience overall. 

Key advantages of Slack include:

  • More robust API and integration options 
  • Slack Apps extend functionality within channels
  • Increased focus on automation and bots
  • Flexibility to customize notifications and workflows
  • Easier deployment of chatbots and dialogs 
  • Global app directory to find pre-built integrations

Critically, Slack makes it simple to embed Salesforce data in conversations, automate notifications, leverage chatbots, and customize two-way syncing between the platforms. Slack’s platform DNA gives it the edge over competitors.

While we love Slack too, here at Omnitoria we are kind of partial to Google Chat though it definitely pales in comparison when it comes to out-of-the-box integration with Salesforce. We covered closing that gap in integration capability in our article about how to connect Google Chat with Salesforce.

Steps to Integrate with Slack APIs

The Salesforce and Slack APIs provide several integration options. Here are some ways to connect them, you should also check out the great video by Daniel Peter about ways to integrate Slack with Salesforce for a general overview.

1. Use Slack’s Webhooks to set up event-driven notifications from Salesforce. For example, notify a channel when an opportunity closes.

2. Build a Slack App or Bot that interacts with Salesforce data like leads, accounts, cases etc.

3. Leverage Salesforce Actions to create messages, files or posts in Slack when Salesforce records are created/updated. 

4. Use Salesforce Flow Builder to add logic and interact with the Slack API. For example, look up Slack users and post messages.

5. Query Salesforce data from Slack using the simple slash command integration /salesforce find {account_name}

6. Embed Salesforce reports, dashboards, and schema data into Slack using Salesforce for Slack.

Some of these integrations don’t require coding. You can use declarative tools for building integrations between the two platforms.

You can also use native apps that Salesforce has created for Slack, but the simplest of these integrations require a lot of administration and configuration work as the 23-page guide suggests.

Slack for Salesforce App also has these limitations:
Slack OAuth is on a PER USER basis, which means that each user needs to complete the OAuth steps in Sections 6 and 8 before they can post to/from Slack, link channels, etc. 

When multiple users are connected to the same Slack Team, there will be multiple entries in the Salesforce Chatter Connector in the Slack web manager.

There are a lot of options where you can integrate with Slack, but all of them have limitations that should be considered before implementing.

Declarative Webhooks solves these problems by letting you access the full power of Slack API by using no code automation instead of code. 

Needless to say, you can also use Declarative Webhooks for any 2-way integration with the software of your choice. Our automation will let us post a message to our Slack channel whenever an event occurs. For example, we will post to our channel whenever a big opportunity is Closed / Won.

Slack Channel, App and Incoming Webhook Setup

We will first create a channel in Slack. You can sign up for a new account here, after you log in to your Slack org, create a channel that will post messages.

You can either use the desktop or web application and you can invite external users as long as you have the trial mode. You can also change the visibility of these channels.

Click the channel name and invite other people also automatically everyone who joins the Slack org.

Next, we will go to the Slack setup and configure an inbound or incoming webhook in Slack terms. Head over the API page and click the Create an App button.

Select from Scratch and give it a descriptive name.

Next, head over to the Incoming Webhooks tab, activate it, and click the Add New Webhook to Workspace button.

Choose a channel to add this webhook and confirm the prompt, after this, you will see that it was successfully added to the channel. 

Make sure you save the Webhook URL to be used later.

Salesforce Setup of Slack URL Remote Site Setting

Now, let’s add this webhook URL to our remote site settings. Go to Setup > Remote Sites and add the webhook URL to the list.

Salesforce Integration with Slack Setup Using Declarative Webhooks

First, we need to create a callout template. Go to the Declarative Webhooks App > Callout Templates and click new.

Notice we are using the webhook URL saved earlier from Slack. Proceed with application/json for the header after you save and continue.

Next, we’re going to map the field and use a formula to construct our message to be sent to Slack. Here’s what it should look like:

First, add a node called “text” and make the data type text. Next, you can build this formula below:

“Big deal alert! ” &  Name  & ” has been closed won” & ” for” & ” ” &  Amount

You can also update a field if a Slack message is sent. In our case no response is needed and you can always check the Call Logs tab in the Declarative Webhooks app.

Salesforce Record Triggered Flow Setup to Make a Callout to Slack

The first step is creating a record-triggered flow on the Opportunity object, we’re going to determine if this is a big deal Opportunity by checking the Opportunity’s amount field. 

If it’s above a certain number and the status is Closed/Won, we are going to call the Declarative Webhooks outbound template by providing the recordId of the Opportunity record who started the flow. Here’s what it should look like below.


Make sure you have activated both your outbound template and flow and you’re good to go!

If you want to learn more about Declarative Webhooks, please follow the links below: