Slack is a popular business communication platform that lets you organize all your business-related chats by specific topics, groups, or direct messaging.
Find the open source transformer code for this destination in the GitHub repository.
Getting started
RudderStack supports sending event data to Slack via the following connection modes:
Connection Mode
Web
Mobile
Server
Device mode
-
-
-
Cloud mode
Supported
Supported
Supported
Once you have confirmed that the source platform supports sending events to Slack, follow these steps:
From your RudderStack dashboard, add a source. Then, from the list of destinations, select Slack.
Assign a name to the destination and click Continue.
Connection settings
Use the following settings to send an event to a particular Slack channel:
Type of incoming webhooks: Select the API from the dropdown that RudderStack uses to send data to the particular Slack channel.
Legacy: RudderStack maps the channel based on the Event Channel Name setting. Note that this method may be deprecated soon.
Modern: RudderStack maps the channel based on the Event Channel Webhook setting.
Event Name: Enter the event name or the regex to match the RudderStack event name.
Event Channel Webhook: Enter the webhook URL of the Slack channel where RudderStack sends the above event.
To get the URL for Event Channel Webhook setting, make sure you have:
Created a Slack app with Incoming Webhooks feature enabled.
Authorized the app to post to your specified Slack channel.
Event Channel Name: Enter the Slack channel’s name where RudderStack should send the above event using the legacy method. You can specify #channel_name or @user_name. If not specified, RudderStack sends the events to the Slack channel associated with the incoming webhook URL (Webhook URL setting below).
Regex Matching: Enable this setting if the event name in the first parameter is a regular expression.
RudderStack adds the global g parameter implicitly. Hence, you need not add it with the regex.
Identify Template: Specify the template used to transform the identify event before sending it to Slack. RudderStack uses the following default template:
Here, the traits key and value are the key-value pairs in the traits object of the identify event payload.
The name field in the template is determined from either of the following:
traits.name
traits.firstName + traits.lastName
traits.username
properties.email
traits.email
User userId
Anonymous user anonymousId
Only the traits listed in the Allowlisted Traits setting are considered to be a part of the identify template. The rest are not sent to Slack.
Use the following settings to transform an event before sending it to Slack:
Event Name: Enter the event name or the regex to match the RudderStack event name.
Event Template: Specify the template used to transform the above event. RudderStack uses the following default template. Note that RudderStack determines name similar to the Identify Template setting described above.
{{name}} did {{event}}
Regex Matching: Enable this setting if the event name is a regex in the first parameter.
Webhook URL: Enter your Slack’s incoming webhook URL. For more information on obtaining this URL, refer to the FAQ section below.
By default, RudderStack sends all the events to the channel associated with the incoming webhook URL.
Allowlisted Traits: Specify the user traits to be allowlisted. If not specified, RudderStack sends all the user traits to Slack.
Denylisted Events: Enter the events to add to your denylist. RudderStack will drop these events.
OneTrust cookie categories: Use this setting to associate OneTrust cookie consent groups to Slack.
Handlebar expressions
RudderStack supports Handlebar expression by leveraging the handlebars.js library for including the variables into your dynamic Slack messages.
Accessible Variables
The following table lists the variables you can select in your template messages:
Handlebar expression
Output
{{name}}
Identity name of the user in the priority order listed above.
{{event}}
Event name, for example, Product Viewed or user login.
{{key_1}} {{properties.key_1}}
The property values from the event’s properties object.
{{propertiesList}}
JSON stringified version of your properties object.
{{traits}}
JSON stringified version of your traits object.
{{traitsList.key_1}}
The trait values from the event’s traits object.
Escaped content
The values returned by {{variable}} are HTML-escaped. For example, if a variable has a & in its value then it will be returned as &. To avoid this behavior, you can use the triple curly braces instead of double, like {{{variable}}} instead of {{variable}}. This will stop the handlebars from escaping a value if there is one, as shown in the following example:
Expression
Variable
Result
{{variable}}
"Marcia & Jan"
"Marcia & Jan"
{{{variable}}}
"Marcia & Jan"
"Marcia & Jan"
For more information on the escaped content, refer to the Handlebar guide.
Identify
The identify call lets you identify a visiting user and associate them to their actions. It also lets you record the traits about them like their name, email address, etc.
A sample identify call for a template, like Identified {{name}} with {{traits}}, is shown below:
For the above event, you will see the message Identified Alex Keener with name: Alex Keener email: alex@example.com country: USA in your configured Slack channel.
Track
The track call lets you record the user events, that is, the actions your users perform, along with any properties associated with these actions.
A sample track call for a template {{name}} performed {{event}} with {{properties.key1}} {{properties.key2}}after the user is identified is as follows:
For the above snippet, you will see the message Alex Keener performed test_event with test_val1 test_val2 test_val3 in your configured Slack channel.
FAQ
How do I obtain the incoming webhook URL?
To obtain the webhook URL, follow the below steps:
Click your Slack workspace name, then go to Administration > Manage Apps.
Search for Incoming webhooks in the Slack app directory and add it to Slack by clicking on Add to Slack.
Select a channel where you want to post the messages forwarded by the webhook and click Add Incoming webhooks integration.
Finally, copy the webhook URL and enter it in the RudderStack dashboard.
Why am I getting Slack messages for all the incoming events in one channel?
By default, RudderStack sends all the events to the Slack channel associated with the incoming webhook URL (Webhook URL setting in the RudderStack dashboard).
To get specific events in a particular channel, make sure you specify the mappings using the Event Name and Event Channel settings.
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.