Slack Component
Send messages to Slack channels and users
Component key: slack#
DescriptionThe Slack component allows you to post messages to a Slack channel.
#
Slack Connections#
Slack OAuth 2.0The vast majority of actions in this component use OAuth 2.0 for authentication. To create a Slack OAuth 2.0 connection, first create and configure a Slack App by visiting the Slack Developer App Portal:
- Click Create New App
- Choose to create the app From scratch
- Give your app a name and select your workspace. We'll configure it to be multi-workspace capable in a moment
- Select OAuth & Permissions from the sidebar
- Under Redirect URLs, add
https://oauth2.prismatic.io/callback
as a redirect URL. - At the bottom, add some User Token Scopes if you plan for this integration to send messages on behalf of customers, or Bot Token Scopes if a Slack "bot" will send the messages.
What scopes you need is dependent on what types of things your Slack integration will need to do (create channels, send messages, etc).
If you just need to send messages to a channel as a bot, add these scopes:
chat:write chat:write.public
. If you want to send messages as a user, see the section below.
- Under Redirect URLs, add
- Next, select Distribute App under Manage Distribution. Confirm that you have "removed hard coded information" and select Activate Public Distribution. Your app needs to be publicly distributed for your customers to install it in their Slack workspaces.
- Finally, open Basic Information. Take note of the Client ID, Client Secret and Signing Secret.
Now it's time to configure your integration to use your Slack OAuth 2.0 app. Add a Slack step to your integration - that'll create a connection config variable for you. Open up that connection config variable.
Enter Client ID, Signing Secret and Client Secret that you noted before.
The Scopes that you need to enter depends on what Slack actions your integration includes:
- If you're just sending messages to a channel, you can enter the scopes
chat:write chat:write.public
and that will assign you a bot token that can write messages to public channels. See below for information on sending messages to private channels. - Conversation and channel-related actions require
admin.conversations:write
.
Enter scopes with spaces in between them (e.g. chat:write users:read users:read.email
).
A list of all Slack OAuth scopes and what each does are available in their docs.
#
Sending messages to private channelsThe chat:write.public
scope allows your bot to send messages to public channels.
If you would like to send messages to private channels, or would like to be more selective about what channels your bot can send messages to, your customer will need to invite the bot to specific channels.
If a bot does not have chat:write.public
or tries to write to a private channel it's not a part of, you'll receive a not_in_channel
error from Slack when you attempt to send a message to that channel.
#
Sending messages as a userSlack applications typically send messages as bot users.
If you would instead like to send messages as a user, edit the Auth URL
add chat:write
to a user_scope query parameter on the Authorization URL to get a User token. To manage channels, add the channels:write
scope.
Your Auth URL
, then, will look something like this: https://slack.com/oauth/v2/authorize?user_scope=chat:write
#
Dynamically changing your bot's nameYour bot's username and icon are things you set when you create your Slack app.
If you would like to override your bot's username within your integration, you will need to request the chat:write.customize
scope in addition to chat:write
.
#
GovSlackSlack offrs GovSlack for government organizations that require compliance with FIPS 140-2, FedRAMP, ITAR, etc.
To use the Slack component with GovSlack, change the beginning of OAuth auth URL, token URL, and revoke URL from https://slack.com
to https://slack-gov.com
.
The component will automatically point API requests towards the Slack Gov API endpoint.
Input | Default | Notes | Example |
---|---|---|---|
Input Authorize URL string / Required | Default https://slack.com/oauth/v2/authorize | Notes The OAuth 2.0 Authorization URL for Slack. If you want to request access to the API on behalf of a user, append a 'user_scope' query parameter to the end of the Authorize URL: https://slack.com/oauth/v2/authorize?user_scope=chat:write | Example |
Input Client ID string / Required | Default | Notes | Example |
Input Client Secret password / Required | Default | Notes | Example |
Input Is User boolean / Required | Default false | Notes Flip the flag to true if you want to access the API as a user. If flipped you must also provide a 'user_scope' query parameter to the end of the Authorize URL. Leaving the flag false will grant you a bot token instead. | Example |
Input Revoke URL string / Required | Default https://slack.com/api/auth.revoke | Notes The OAuth 2.0 Revocation URL for Slack | Example |
Input Scopes string / Required | Default chat:write chat:write.public chat:write.customize channels:read groups:read im:read mpim:read | Notes A space-delimited set of one or more scopes to get the user's permission to access. | Example chat:write chat:write.public users:read channels:read files:read files:write channels:write channels:history groups:history mpim:history im:history |
Input Signing Secret password / Required | Default | Notes | Example |
Input Token URL string / Required | Default https://slack.com/api/oauth.v2.access | Notes The OAuth 2.0 Token URL for Slack | Example |
#
Webhook URLThe Slack Message from Webhook and the Slack Block Message from Webhook actions are the only Slack actions that do not authenticate with OAuth. Instead, it uses Slack Incoming Webhooks. For your customers to use this authorization method, they will need to create their own Slack apps and incoming webhooks.
To generate a Slack incoming webhook URL:
- Navigate to https://api.slack.com/apps
- Click Create New App, adding an app to your workspace.
- Under Add features and functionality select Incoming Webhooks
- Activate Incoming Webhooks and then Add New Webhook to Workspace
- Take note of the Webhook URL. It should be of the form
https://hooks.slack.com/services/foo/bar/baz
Input | Notes | Example |
---|---|---|
Input Webhook URL string / Required | Notes The Slack webhook URL. Instructions for generating a Slack webhook are available on the Slack component docs page. | Example https://hooks.slack.com/services/TXXXX/BXXXXX/XXXXXXX |
#
Triggers#
Slack App WebhookTrigger for handling slash command and modal webhooks from Slack | key: slashCommandWebhook
Input | Default | Notes |
---|---|---|
Input Content Type string / Required | Default text/plain | Notes |
Input Response Body code | Default | Notes |
Input Connection connection / Required | Default | Notes The connection to use |
#
Slack Events API WebhookTrigger for handling webhooks from Slack's events API | key: webhook
Input | Notes |
---|---|
Input Connection connection / Required | Notes The connection to use |
You can configure Slack to send events to a Prismatic integration. This webhook trigger uses your Slack app's signing secret to verify that messages come from Slack. If a challenge request is received, this trigger responds with the proper challenge response and this trigger follows the "URL Verify" branch. For other notifications, like a "channel create" event occurred, this trigger follows the "Notification" path.
If you would like to invoke a flow that uses a Slack webhook trigger from an app other than Slack, you can send an additional header, prismatic-bypass-challenge: true
with your request, to bypass Slack message verification.
When that header is present your integration will follow the "Management" branch.
#
Output Example Payload{ "branch": "Notification", "payload": { "headers": { "accept": "*/*", "Content-Type": "application/json", "User-Agent": "Slackbot 1.0 (+https://api.slack.com/robots)", "Host": "hooks.example.prismatic.io" }, "body": { "data": {} }, "rawBody": { "data": { "type": "Buffer", "data": [69, 120, 97, 109, 112, 108, 101] } }, "queryParameters": {}, "webhookUrls": { "Flow 1": "https://hooks.example.prismatic.io/trigger/EXAMPLEGbG93Q29uZmlnOmRlNmNmNDMyLTliNWMtN0005NDMxLTRmYzA4ZjViODgxOA==" }, "webhookApiKeys": { "Flow 1": ["abc-123"] }, "customer": { "externalId": "customer-example-external-id", "name": "John Doe" } }, "response": { "statusCode": 200, "contentType": "text/plain", "body": "3eZbrw1aBm2rZgRNFdxV2595E9CY3gmdALWMmHkvFXO7tYXAYM8P" }}
#
Data Sources#
Select ChannelSelect a Slack channel from a dropdown menu | key: selectChannels | type: picklist
Input | Default | Notes |
---|---|---|
Input Connection connection / Required | Default | Notes The connection to use |
Input Include IM channels? boolean | Default false | Notes |
Input Include multi-party IM (mpim) channels? boolean | Default false | Notes |
Input Include private channels? boolean | Default false | Notes |
Input Include public channels? boolean | Default true | Notes |
Input Show channel ID in dropdown? boolean | Default false | Notes Show '#my-channel' vs. '#my-channel (ID: C123456)' |
#
Data Source Payload{ "result": [ { "key": "C123456", "label": "#general (ID: C123456)" }, { "key": "C000000", "label": "#other-channel (ID: C000000)" }, { "key": "C555555", "label": "#random (ID: C555555)" } ]}
#
Actions#
Archive ConversationArchive an existing conversation | key: archiveConversation
Input | Notes | Example |
---|---|---|
Input Channel Name or ID string / Required | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Notes The connection to use | Example |
#
Close ConversationClose an existing conversation | key: closeConversation
Input | Notes | Example |
---|---|---|
Input Connection connection / Required | Notes The connection to use | Example |
Input Conversation Name string / Required | Notes The name of the Slack conversation. | Example Book Club |
#
Conversation ExistsReturns true if the conversation already exists | key: conversationExists
Input | Notes | Example |
---|---|---|
Input Channel Name or ID string / Required | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Notes The connection to use | Example |
#
Create ConversationCreate a new conversation | key: createConversation
Input | Default | Notes | Example |
---|---|---|---|
Input Connection connection / Required | Default | Notes The connection to use | Example |
Input Conversation Name string / Required | Default | Notes The name of the Slack conversation. | Example Book Club |
Input Is Private boolean / Required | Default false | Notes This flag will determine if the Slack conversation is private. | Example |
Input Team Id string | Default | Notes The Id of the Slack team. | Example 84350944036 |
#
Output Example Payload{ "data": { "ok": true, "channels": [ { "id": "COZ7e3d", "name": "example channel", "is_channel": true, "is_group": false, "is_im": false, "is_private": false, "is_archived": false, "created": 6426934241, "creator": "example", "unlinked": 0, "name_normalized": "example channel", "shared_team_ids": [ "TW2oP78" ], "purpose": { "value": "This channel was created for an example response." } } ] }}
#
Delete a pending scheduled messageDelete the content and metadata of a pending scheduled message from a queue | key: deletePendingMessage
Input | Notes | Example |
---|---|---|
Input Channel ID string / Required | Notes The static ID of the Slack channel. | Example C02MS7HV6KB |
Input Connection connection / Required | Notes The connection to use | Example |
Input Message Id string / Required | Notes A unique identifier of a message or thread to reply to (thread_ts) | Example 84350944036 |
#
Delete messageDelete the content and metadata of an existing message | key: deleteMessage
Input | Notes | Example |
---|---|---|
Input Channel ID string / Required | Notes The static ID of the Slack channel. | Example C02MS7HV6KB |
Input Connection connection / Required | Notes The connection to use | Example |
Input Message Id string / Required | Notes A unique identifier of a message or thread to reply to (thread_ts) | Example 84350944036 |
#
Get Conversation HistoryGet the history of a conversation | key: getConversationsHistory
Input | Default | Notes | Example |
---|---|---|---|
Input Channel Name or ID string / Required | Default | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Default | Notes The connection to use | Example |
Input Cursor string | Default | Notes Provide a cursor pointing to the page you would like to access | Example 3 |
Input Include All Metadata boolean | Default | Notes | Example |
Input Inclusive boolean | Default | Notes Include messages with oldest or latest timestamps in results. Ignored unless either timestamp is specified | Example |
Input Latest string | Default | Notes Only messages before this Unix timestamp will be included in results. Default is current time. | Example |
Input Limit string | Default | Notes Provide a numerical limit to the amount of results returned. | Example 80 |
Input Oldest string | Default | Notes Only messages after this Unix timestamp will be included in results | Example |
#
Output Example Payload{ "data": { "ok": true, "messages": [ { "client_msg_id": "123123-123123-123123", "type": "message", "text": "hello world", "user": "U01QFFSE2QK", "ts": "166149417.178179", "team": "TH0GJM0M8" } ] }}
#
Get User By EmailGet a user's information by email | key: getUser
Input | Notes | Example |
---|---|---|
Input Connection connection / Required | Notes The connection to use | Example |
Input Email string / Required | Notes Provide a string value for the email address of the user. | Example someone@example.com |
#
Output Example Payload{ "data": { "ok": true, "user": { "id": "example", "color": "example", "deleted": false, "real_name": "Example User", "name": "Example User", "tz": "America/Chicago", "profile": { "title": "example", "phone": "example", "skype": "example", "real_name": "Slackbots", "real_name_normalized": "example", "first_name": "example", "email": "example", "team": "example", "display_name": "example" } } }}
#
Get User By IDGet a user's information by ID | key: getUserById
Input | Notes | Example |
---|---|---|
Input Connection connection / Required | Notes The connection to use | Example |
Input User ID string / Required | Notes | Example W012A3CDE |
#
Output Example Payload{ "data": { "ok": true, "user": { "id": "example", "color": "example", "deleted": false, "real_name": "Example User", "name": "Example User", "tz": "America/Chicago", "profile": { "title": "example", "phone": "example", "skype": "example", "real_name": "Slackbots", "real_name_normalized": "example", "always_active": true, "first_name": "example", "email": "example", "team": "example", "display_name": "example" } } }}
#
Invite User To ConversationInvite a user to an existing conversation | key: inviteUserToConversation
Input | Notes | Example |
---|---|---|
Input Channel Name or ID string / Required | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Notes The connection to use | Example |
Input User Id string / Required | Notes Provide a string value for the unique identifier of the user you want to send the message to. | Example 84350944036 |
#
Leave ConversationsLeave an existing conversation | key: leaveConversation
Input | Notes | Example |
---|---|---|
Input Channel Name or ID string / Required | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Notes The connection to use | Example |
#
List Conversation MembersList all members of a conversation | key: listConversationMembers
Input | Notes | Example |
---|---|---|
Input Channel Name or ID string / Required | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Notes The connection to use | Example |
Input Cursor string | Notes Provide a cursor pointing to the page you would like to access | Example 3 |
Input Limit string | Notes Provide a numerical limit to the amount of results returned. | Example 80 |
#
List ConversationsList all conversations | key: listConversations
Input | Default | Notes | Example |
---|---|---|---|
Input Connection connection / Required | Default | Notes The connection to use | Example |
Input Cursor string | Default | Notes Provide a cursor pointing to the page you would like to access | Example 3 |
Input Exclude Archived boolean | Default false | Notes This flag will determine if archived results will be excluded from the result set. | Example |
Input Include IM channels? boolean | Default false | Notes | Example |
Input Include multi-party IM (mpim) channels? boolean | Default false | Notes | Example |
Input Include private channels? boolean | Default false | Notes | Example |
Input Include public channels? boolean | Default true | Notes | Example |
Input Limit string | Default | Notes Provide a numerical limit to the amount of results returned. | Example 80 |
Input Team Id string | Default | Notes The Id of the Slack team. | Example 84350944036 |
#
Output Example Payload{ "data": { "ok": true, "channels": [ { "id": "COZ7e3d", "name": "example channel", "is_channel": true, "is_group": false, "is_im": false, "is_private": false, "is_archived": false, "created": 6426934241, "creator": "example", "unlinked": 0, "name_normalized": "example channel", "shared_team_ids": [ "TW2oP78" ], "purpose": { "value": "This channel was created for an example response." } } ] }}
#
List FilesList all available files | key: listFiles
Input | Notes | Example |
---|---|---|
Input Connection connection / Required | Notes The connection to use | Example |
Input Cursor string | Notes Provide a cursor pointing to the page you would like to access | Example 3 |
#
List Scheduled MessagesList all scheduled messages | key: listScheduledMessages
Input | Notes |
---|---|
Input Connection connection / Required | Notes The connection to use |
#
List UsersList Users | key: listUsers
Input | Notes | Example |
---|---|---|
Input Connection connection / Required | Notes The connection to use | Example |
Input Cursor string | Notes Provide a cursor pointing to the page you would like to access | Example 3 |
Input Limit string | Notes Provide a numerical limit to the amount of results returned. | Example 80 |
Input Team Id string | Notes The Id of the Slack team. | Example 84350944036 |
#
Output Example Payload{ "data": { "ok": true, "members": [ { "id": "Exmple", "team_id": "34700c09vs0zx", "name": "Example", "deleted": false, "color": "37373", "profile": { "title": "example", "phone": "example", "skype": "example", "real_name": "Slackbots", "real_name_normalized": "example", "always_active": true, "first_name": "example", "email": "example", "team": "example", "display_name": "example" } } ], "response_metadata": { "next_cursor": "", "scopes": [ "admin", "idetify", "channels:read" ] } }}
#
List Users ConversationsList Users Conversations | key: listUsersConversations
Input | Notes | Example |
---|---|---|
Input Connection connection / Required | Notes The connection to use | Example |
Input Cursor string | Notes Provide a cursor pointing to the page you would like to access | Example 3 |
Input Limit string | Notes Provide a numerical limit to the amount of results returned. | Example 80 |
Input Team Id string | Notes The Id of the Slack team. | Example 84350944036 |
Input User Id string / Required | Notes Provide a string value for the unique identifier of the user you want to send the message to. | Example 84350944036 |
#
Output Example Payload{ "data": { "ok": true, "channels": [ { "id": "COZ7e3d", "name": "example channel", "is_channel": true, "is_group": false, "is_im": false, "is_private": false, "is_archived": false, "created": 6426934241, "creator": "example", "unlinked": 0, "name_normalized": "example channel", "shared_team_ids": [ "TW2oP78" ], "purpose": { "value": "This channel was created for an example response." } } ] }}
#
Post Block MessagePost a message to a slack channel | key: postBlockMessage
Input | Default | Notes | Example |
---|---|---|---|
Input Blocks code / Required | Default
| Notes A JSON array containing blocks (objects) that make up the desired message. Use Slack's Block Kit Builder (https://app.slack.com/block-kit-builder/) to build block messages. | Example |
Input Channel Name or ID string / Required | Default | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Default | Notes The connection to use | Example |
Input Alt Message text / Required | Default | Notes This message will override if your block cannot be sent | Example Hello from Prismatic! |
Input Message Id string | Default | Notes A unique identifier of a message or thread to reply to (thread_ts) | Example 84350944036 |
Input Bot Username string | Default | Notes The username of the bot the message will be sent from. This requires the 'chat:write.customize' scope. | Example exampleUser |
#
Output Example Payload{ "data": { "ok": true, "channel": "C011B7U3R9U", "ts": "1646951430.367539", "message": { "type": "message", "subtype": "bot_message", "text": "The message I sent", "ts": "1646951430.367539", "username": "My Slack App", "bot_id": "B036D2DCT54" }, "response_metadata": { "scopes": [ "identify", "chat:write", "chat:write.public", "chat:write.customize" ], "acceptedScopes": [ "chat:write" ] } }}
#
Post Ephemeral MessagePost an ephemeral message to a user or channel | key: postEphemeralMessage
Input | Notes | Example |
---|---|---|
Input Channel Name or ID string / Required | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Notes The connection to use | Example |
Input Message text / Required | Notes The message to send the Slack channel. | Example Hello from Prismatic! |
Input User Id string / Required | Notes Provide a string value for the unique identifier of the user you want to send the message to. | Example 84350944036 |
Input Bot Username string | Notes The username of the bot the message will be sent from. This requires the 'chat:write.customize' scope. | Example exampleUser |
#
Post MessagePost a message to a slack channel | key: postMessage
Input | Notes | Example |
---|---|---|
Input Channel Name or ID string / Required | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Notes The connection to use | Example |
Input Message text / Required | Notes The message to send the Slack channel. | Example Hello from Prismatic! |
Input Message Id string | Notes A unique identifier of a message or thread to reply to (thread_ts) | Example 84350944036 |
Input Bot Username string | Notes The username of the bot the message will be sent from. This requires the 'chat:write.customize' scope. | Example exampleUser |
#
Output Example Payload{ "data": { "ok": true, "channel": "C011B7U3R9U", "ts": "1646951430.367539", "message": { "type": "message", "subtype": "bot_message", "text": "The message I sent", "ts": "1646951430.367539", "username": "My Slack App", "bot_id": "B036D2DCT54" }, "response_metadata": { "scopes": [ "identify", "chat:write", "chat:write.public", "chat.write.customize" ], "acceptedScopes": [ "chat:write" ] } }}
#
Rename ConversationRename an existing conversation | key: renameConversation
Input | Notes | Example |
---|---|---|
Input Connection connection / Required | Notes The connection to use | Example |
Input Conversation Name string / Required | Notes The name of the Slack conversation. | Example Book Club |
Input New Conversation Name string / Required | Notes The name of the Slack conversation. | Example Book Club |
#
Set Conversation PurposeSet the purpose of an existing conversation | key: setConversationPurpose
Input | Notes | Example |
---|---|---|
Input Channel Name or ID string / Required | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Notes The connection to use | Example |
Input Conversation Purpose string | Notes Provide a string value for the purpose of the given conversation. | Example Engineering |
Input User Id string / Required | Notes Provide a string value for the unique identifier of the user you want to send the message to. | Example 84350944036 |
#
Set Conversation TopicSet the purpose of an existing conversation | key: setConversationTopic
Input | Notes | Example |
---|---|---|
Input Channel Name or ID string / Required | Notes The name or static ID of the Slack channel. | Example general |
Input Connection connection / Required | Notes The connection to use | Example |
Input Conversation Topic string | Notes Provide a string value for the topic of the given conversation. | Example Engineering |
Input User Id string / Required | Notes Provide a string value for the unique identifier of the user you want to send the message to. | Example 84350944036 |
#
Slack Block Message From WebhookPost a block formatted message to a Slack channel from a webhook URL | key: postWebhookBlockMessage
Input | Default | Notes | Example |
---|---|---|---|
Input Blocks code / Required | Default
| Notes A JSON array containing blocks (objects) that make up the desired message. Use Slack's Block Kit Builder (https://app.slack.com/block-kit-builder/) to build block messages. | Example |
Input Connection connection / Required | Default | Notes The connection to use | Example |
Input Alt Message text / Required | Default | Notes This message will override if your block cannot be sent | Example Hello from Prismatic! |
#
Output Example Payload{ "data": { "text": "ok" }}
#
Slack Message From WebhookPost a message to a Slack channel from a webhook URL | key: postSlackMessage
Input | Notes | Example |
---|---|---|
Input Connection connection / Required | Notes The connection to use | Example |
Input Message text / Required | Notes The message to send the Slack channel. | Example Hello from Prismatic! |
#
Output Example Payload{ "data": { "text": "ok" }}
#
Update MessageUpdate the contents of an existing message | key: updateMessage
Input | Notes | Example |
---|---|---|
Input Channel ID string / Required | Notes The static ID of the Slack channel. | Example C02MS7HV6KB |
Input Connection connection / Required | Notes The connection to use | Example |
Input Message text / Required | Notes The message to send the Slack channel. | Example Hello from Prismatic! |
Input Message Id string / Required | Notes A unique identifier of a message or thread to reply to (thread_ts) | Example 84350944036 |
#
Upload FileUpload a new file to a slack conversation | key: uploadFile
Input | Notes | Example |
---|---|---|
Input Channels string | Notes Provide a comma separated list of channel names, or ids that the file will be shared in. | Example general,marketing |
Input Connection connection / Required | Notes The connection to use | Example |
Input Cursor string | Notes Provide a cursor pointing to the page you would like to access | Example 3 |
Input File Content data / Required | Notes Provide the data for a file to be uploaded | Example |
Input File Name string / Required | Notes Provide a name for the file. | Example reports.csv |
Input File Name string / Required | Notes A full list of supported file types can be found here: https://api.slack.com/types/file#file_types | Example csv |
Input Initial Comment string | Notes The message text introducing the file in the specified channels when uploaded | Example Example message |
Input Thread Reply string | Notes Provide another message's ts value to upload this file as a reply. Never use a reply's ts value, use the parent instead. | Example u830hd230 |
Input File Title string | Notes The title of the file as it will appear in the channel | Example Monthly Reports |