slack_post
Posts a new message to a Slack channel using the Slack API method chat.postMessage.
Introduced in version 4.52.0.
# Common configuration fields, showing default values
output:
label: ""
slack_post:
bot_token: "" # No default (required)
channel_id: "" # No default (required)
thread_ts: "" # No default (optional)
text: "" # No default (optional)
blocks: "" # No default (optional)
markdown: true
unfurl_links: false
unfurl_media: true
link_names: 0
See also: Examples
Fields
blocks
A Bloblang query that should return a JSON array of Slack blocks.
You can either specify message content in the text or blocks fields, but not both.
Type: string
bot_token
Your Slack bot user’s OAuth token, which must have the correct permissions to post messages to the target Slack channel.
Type: string
channel_id
The encoded ID of the target Slack channel. This field supports interpolation functions.
Type: string
link_names
When set to 1, this output finds and links to user groups mentioned in Slack messages.
Type: bool
Default: false
markdown
When set to true, this output accepts message content in Markdown format.
Type: bool
Default: true
text
The text content of the message. This field supports interpolation functions.
You can either specify message content in the text or blocks fields, but not both.
Type: string
Default: ""
thread_ts
Specify the thread timestamp (ts value) of another message to post a reply within the same thread. This field supports interpolation functions.
Type: string
Default: ""
unfurl_links
When set to true, this output provides previews of linked content in Slack messages. For more information about unfurling links, see the Slack documentation.
Type: bool
Default: false
Examples
Echo Slackbot
A slackbot that echo messages from other users
input:
slack:
app_token: "${APP_TOKEN:xapp-demo}"
bot_token: "${BOT_TOKEN:xoxb-demo}"
pipeline:
processors:
- mutation: |
# ignore hidden or non message events
if this.event.type != "message" || (this.event.hidden | false) {
root = deleted()
}
# Don't respond to our own messages
if this.authorizations.any(auth -> auth.user_id == this.event.user) {
root = deleted()
}
output:
slack_post:
bot_token: "${BOT_TOKEN:xoxb-demo}"
channel_id: "${!this.event.channel}"
thread_ts: "${!this.event.ts}"
text: "ECHO: ${!this.event.text}"