Close Menu
SalesforceCodex
    Facebook X (Twitter) Instagram
    Trending
    • Building a Dynamic Tree Grid in Lightning Web Component
    • 10 Salesforce Chrome Extensions to Boost Your Productivity
    • How to Build a Generic Modal Window in Lightning Web Component
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    • How to Implement Dynamic Queueable Chaining in Salesforce Apex
    • How to Implement Basic Queueable Chaining in Salesforce Apex
    • How to Suppress PMD Warnings in Salesforce Apex
    Facebook X (Twitter) Instagram
    SalesforceCodex
    Subscribe
    Saturday, July 5
    • Home
    • Architecture
    • Salesforce
      • News
      • Apex
      • Integration
      • Books Testimonial
    • Questions
    • Certification
      • How to Prepare for Salesforce Integration Architect Exam
      • Certification Coupons
    • Integration Posts
    • Downloads
    • About Us
      • Privacy Policy
    SalesforceCodex
    Home»Salesforce»Apex»Integrate Slack in Salesforce for Real-Time Notifications

    Integrate Slack in Salesforce for Real-Time Notifications

    Dhanik Lal SahniBy Dhanik Lal SahniAugust 13, 2023No Comments6 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email
    Integrate Slack in Salesforce
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Slack is a cloud-based collaboration application meant to improve organisational communication and teamwork. It is a central hub for teams and individuals to interact, share files, and work on projects together. Slack has features such as channels for different topics or groups, direct messaging, file sharing, connectivity with other tools and services, and the ability to search and archive conversations to help speed collaboration. In this post, we will integrate Slack in Salesforce for Customized Push Notifications using Apex and Flow.

    Steps required for Integrating Slack in Salesforce

    We can integrate Slack in Salesforce using no code, low code as well as a pro code approach. In this post, we will use the low and pro-code approach in this post. Below steps are required for Slack integration

    1. Slack Channel Creation
    2. Create Slack Incoming Webhook
    3. Consume Webhook in Apex
    4. Consume Webhook in Flow

    Let us complete all the above steps one by one.

    1. Slack Channel Creation

    We will push notifications to some channels where people are collaborating on some projects. If you have a Slack channel already for testing this POC then you can use it otherwise you can create a new Slack channel. If you are new to Slack then you can register it here for free.

    Once you have access to Slack, open its application to create a channel. You can install the desktop version of the Slack application as well.

    a) Click on Channels to create a new Channel similar to the below image.

    Slack Channel Creation - Integrate Slack in Salesforce

    b) Provide the meaningful name of the channel. We can put the project name, module name or client name etc.. for the channel name. If we want to add external people as well to our channel then select the checkbox “Invite external people.”

    Slack Channel Creation

    c) Select channel visibility type based on your requirement. If visibility is set as public then it will be visible to everyone. If it is private then it is not visible to anyone, it will only be visible who have an invitation link for the channel.

    d) Add all required people to this channel. If all users will be part of this channel who are part of your slack workspace then enable the flag “Automatically add anyone who joins”. All users will automatically be added to the channel.

    Slack Channel Collaboaration- Integrate Slack in Salesforce

    2. Create Slack Incoming Webhook

    We need one Slack app to create an incoming webhook. This webhook will be used to post messages on Slack Channel.

    Create a Slack App

    A Slack app is a software application or program that extends and improves the capabilities of the Slack platform. These apps are designed to work in collaboration with Slack’s communication and collaboration features, allowing users to personalise their Slack experience, automate activities, and link Slack to other tools and services.

    Create an app from https://api.slack.com/apps/ to post messages. Click highlighted Create New App button to create a new app.

    Slack App Creation - Integrate Slack in Salesforce

    Select From Scratch to create an app. This will allow us to put all detail manually.

    Slack App Creation - Integrate Slack in Salesforce

    Give a meaningful name and also select the workspace for this app.

    Slack App Creation - Integrate Slack in Salesforce

    Once App is created, we will create an incoming webhook. Select Incoming Webhook to create a webhook.

    A webhook is an HTTP-based callback function that allows lightweight, event-driven communication between 2 application programming 

    Slack App Webhooks- Integrate Slack in Salesforce

    Activate the incoming webhook by clicking on the below highlight activate flag (on radio button).

    Slack App Creation - Integrate Slack in Salesforce

    Add created webhook to the workspace.

    Select the channel where Webhook will post messages in Slack.

    Slack App Creation - Integrate Slack in Salesforce

    Allow Slack app to post messages in selected channels.

    Slack App Allow Channel- Integrate Slack in Salesforce

    This will create a webhook URL for posting messages in the Slack channel. We will use this URL in Apex and Flow to create notifications.

    Slack App Creation - Integrate Slack in Salesforce

    3. Consume Webhook in Apex

    Let us create an apex class to integrate Slack into Salesforce. For this outbound Salesforce Integration, we need to perform the below steps

    1. Create a Named and External Credential
    2. Create a permission set for external callout
    3. Create a Slack Integration Apex class
    4. Test Apex class

    Follow our blog Low Code Integration for Text Translation using SysTran API to complete the top 2 steps in detail. 

    Create a Named and External Credential

    We will create an External Credential with the name External Callout EC. Check the below image for other details.

    Slack App External Credential- Integrate Slack in Salesforce

    Create a named credential SlackChanneNC for Slack Webhook URL.

    Slack App NamedCredential- Integrate Slack in Salesforce

    Create a permission set for external callout

    Create a permission set Callout User PS and assign the above created external credential to External Credential Principal Access. Once an external credential is assigned, add this permission set to the user. For POC assign this permission set to yourself.

    Slack App Permission Set Assignment- Integrate Slack in Salesforce

    Create a Slack Integration Apex class

    Create a service apex class for integrating Slack webhook.

    Test Apex class to post Messages in the Slack channel

    Let us use the above-created apex class to send messages into Slack Channel. This code block can be called from other apex classes to send messages into Slack Channel.

    SlackService.postMessage('From Apex');

    This will send a message in the Slack channel.

    Slack App Message Posting- Integrate Slack in Salesforce

    4. Consume Webhook in Flow

    We can use the above-created apex class in Flow as well using the Invocable Apex method. Although we can use Webhook completely in Flow with no code approach. We will create another blog for this.

    For this post, let us create an Invocable Apex method to send messages from the flow.

    Consume Invocable Method in Salesforce Flow

    We can use the above invocable method using the Action element in Flow. Place action element on flow designer and select action Post Message to Slack Channel.

    Put dynamic messages based on your requirement. For this POC, I have assigned the hardcoded string “Hello from Flow”

    Integrate Slack in Salesforce

    When this flow will execute, it will run this action and post a message to the Slack channel.

    References:

    Low Code Integration for Text Translation using Systran API

    Sending messages using Incoming Webhooks

    Related Posts

    Exploring GraphQL API in Salesforce

    Text translation in Salesforce Using Apex

    Extract Demographic Detail using Trestle Reverse Phone API

    Shopify integration with Salesforce using Webhook

    Salesforce DropBox Integration to upload files

    Automating data synchronization between Salesforce and Amazon Seller

    Need Help?

    Need some kind of help in implementing this feature, connect on my LinkedIn profile Dhanik Lal Sahni.

    apex external credential flow flow callout integration named credential Permission set rest api salesforce salesforce apex salesforce webhook integration sfdc slack integration slack slack integration slack sfdc integration slack webhook integration in salesforce slack webhook integration in sfdc
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleExploring GraphQL API in Salesforce
    Next Article Enhance Salesforce File Security with FileEvent
    Dhanik Lal Sahni
    • Website
    • Facebook
    • X (Twitter)

    With over 18 years of experience in web-based application development, I specialize in Salesforce technology and its ecosystem. My journey has equipped me with expertise in a diverse range of technologies including .NET, .NET Core, MS Dynamics CRM, Azure, Oracle, and SQL Server. I am dedicated to staying at the forefront of technological advancements and continuously researching new developments in the Salesforce realm. My focus remains on leveraging technology to create innovative solutions that drive business success.

    Related Posts

    By Dhanik Lal Sahni4 Mins Read

    Building a Dynamic Tree Grid in Lightning Web Component

    June 29, 2025
    By Dhanik Lal Sahni9 Mins Read

    10 Salesforce Chrome Extensions to Boost Your Productivity

    June 1, 2025
    By Dhanik Lal Sahni4 Mins Read

    How to Build a Generic Modal Window in Lightning Web Component

    May 26, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Ranked #1 SALESFORCE DEVELOPER BLOG BY SALESFORCEBEN.COM
    Featured on Top Salesforce Developer Blog By ApexHours
    Recent Posts
    • Building a Dynamic Tree Grid in Lightning Web Component
    • 10 Salesforce Chrome Extensions to Boost Your Productivity
    • How to Build a Generic Modal Window in Lightning Web Component
    • Top 10 Salesforce Flow Features of Salesforce Summer ’25
    • Unlock the Power of Vibe Coding in Salesforce
    Ranked in Top Salesforce Blog by feedspot.com
    RSS Recent Stories
    • Top 20 Salesforce Data Cloud Interview Questions & Answers for Admins June 5, 2025
    • How to Connect Excel to Salesforce to Manage Your Data and Metadata February 9, 2025
    • Difference Between With Security and Without Security in Apex January 2, 2025
    • Top Reasons to Love Salesforce Trailhead: A Comprehensive Guide December 5, 2024
    • How to Utilize Apex Properties in Salesforce November 3, 2024
    Archives
    Categories
    Tags
    apex (112) apex code best practice (8) apex rest (11) apex trigger best practices (4) architecture (22) Asynchronous apex (9) AWS (5) batch apex (9) batch processing (4) code optimization (8) custom metadata types (5) design principle (9) einstein (3) flow (15) future method (4) google (6) google api (4) integration (19) integration architecture (6) lighting (8) lightning (66) lightning-combobox (5) lightning-datatable (10) lightning component (32) Lightning web component (64) lwc (53) named credential (8) news (4) optimize apex code (4) Permission set (4) Queueable (9) rest api (23) S3 Server (4) salesforce (143) salesforce apex (48) salesforce api (4) salesforce api integration (5) salesforce bulk api (3) Salesforce Interview Question (4) salesforce news (5) salesforce question (5) solid (6) tooling api (5) Visual Studio Code (3) Winter 20 (8)

    Get our newsletter

    Want the latest from our blog straight to your inbox? Chucks us your detail and get mail when new post is published.
    * indicates required

    Facebook X (Twitter) Instagram Pinterest YouTube Tumblr LinkedIn Reddit Telegram
    © 2025 SalesforceCodex.com. Designed by Vagmine Cloud Solution.

    Type above and press Enter to search. Press Esc to cancel.

    Ad Blocker Enabled!
    Ad Blocker Enabled!
    Our website is made possible by displaying online advertisements to our visitors. Please support us by disabling your Ad Blocker.