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.
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
To successfully configure Slack as a destination, you will need to configure the following settings:
Event channel settings
Use the following settings to send an event to a particular Slack channel:
Setting
Description
Type of incoming webhooks
Select the API from the dropdown that RudderStack uses to send data to the particular Slack channel:
Setting
Description
Legacy
RudderStack maps the channel based on the Event Channel Name setting. This method may be deprecated soon.
Modern (through app)
RudderStack maps the channel based on the Event Channel Webhook setting.
Event Name
Enter the event name or regex to match the RudderStack event name. For example, the regex ^slack\.events\.[a-zA-Z_]+$ matches strings like:
slack.events.message
slack.events.reaction_added
slack.events.user_typing
If an event matches a regex, then RudderStack uses the corresponding Event Channel Webhook and Event Template (if specified).
Event Channel Webhook
Enter the webhook URL of the Slack channel where RudderStack sends the above event. This is a required field if you have set Type of incoming webhooks setting to Modern.
Note: To get the URL for Event Channel Webhook setting, make sure to:
Create a Slack app with the Incoming Webhooks feature.
Authorize the app to post to your specified Slack channel.
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.