Skip to content

Send Slack Message

The Send Slack Message action posts a message to a Slack channel, or sends it directly to a Slack user.

Send Slack Message: Action settings

Send Slack Message: Action settings

Prerequisites: create the Slack credential

Section titled “Prerequisites: create the Slack credential”

The action posts messages as a Slack app (bot), so you need the app’s Bot User OAuth Token, which starts with xoxb-.

  1. Create or open a Slack app in your workspace, and add the following bot token scopes: channels:read, users:read, groups:read, and chat:write.
  2. Install the app to your workspace, and copy the Bot User OAuth Token.
  3. To post to a private channel, invite the app to that channel in Slack.
  4. In AIR, go to Automations > Variables, and create a variable with the token as its value. Turn on Store as Encrypted. See Variables.

Only encrypted variables can be selected as a credential, so the token is never displayed again after you save it.

Send Slack Message: Encrypted variable for the Slack token

Send Slack Message: Encrypted variable for the Slack token

SettingDescription
Slack Bot CredentialThe encrypted variable that holds the bot token.
Target TypeChannels or Users.
Channel / UserThe channel or user to send the message to. The list is loaded from Slack using the selected credential.
MessageThe text to send. Supports expressions.

If the channel or user list stays empty, check the token and the bot token scopes listed above.

  • Plain text: write your message using Slack formatting, such as *bold*, _italic_, and links.
  • Block Kit: paste Slack Block Kit JSON to send a richer layout. You can also use expressions inside the JSON. See Slack’s Block Kit Builder.
Example message
:rotating_light: *{{global.automationName}}* ran on *{{targetAsset.name}}*
High-severity findings: {{start-evidence-acquisition.output.findingCounts.high}}
FieldExample expression
Slack response status{{send-slack-message.output.httpStatus}}
Channel the message was sent to{{send-slack-message.resolvedConfig.channel}}
  • Use Test to post a test message to the selected channel or user.
  • If Slack rejects the message, for example because the token was revoked or the bot is not a member of the channel, the step fails.