Skip to content
Docs

Slack

The Slack node posts a message to Slack. Use it to send notifications, alerts, or an agent’s reply. You find it on the node picker’s Channels — send a reply shelf.

The node has three send modes:

  • Webhook mode: posts to a Slack incoming webhook URL. The target channel is fixed by the webhook.
  • Bot-token mode: posts through the Slack Web API using a bot token in credential, so you can choose the channel per message, reply inside a thread, or edit a message you sent earlier.
  • As a workspace bot: posts as one of your workspace’s Slack bots, the bot you set up under Chat apps, with the token it already holds. It works like bot-token mode, and it also answers the conversation that started the run.

Picking a bot uses the workspace bot, and selecting a credential switches the node to bot-token mode. Without either, it uses the webhook URL. A bot beside a webhook URL or a credential fails.

It has two handles: input, which takes the upstream node’s output (available in every field as $prev), and output, which passes the send result to the next node.

For bot-token mode, store the token as a secret or as a saved connection to Slack and select it in credential. For webhook mode, store the webhook URL in a secret.

The Slack node's settings form, with the fields described below
The Slack node's settings form, with the fields described below
FieldTypeDefaultDescription
Text (text)string ✦ (required) — The text of the Slack message to send.
Webhook URL (webhookUrl)string ✦ (optional) — The Slack incoming-webhook URL to post to. Used only when no bot or bot token is selected.
Blocks (blocks)string ✦ (optional) — Slack Block Kit blocks as a JSON array, for richly formatted messages.
Bot (bot)string ✦ (optional) — The workspace Slack bot to send as: one of its Slack connections, with the bot token it already holds.
Credential (credential)string ✦ (optional) — A Slack bot token to post with via the Web API, when it is not one of the workspace’s Slack bots — a Secret or a saved Connection.
Channel (channel)string ✦ (optional) — The Slack channel id to post into when sending as a bot.
Thread ts (threadTs)string ✦ (optional) — The timestamp (ts) of a parent message to reply in its thread.
Message ts (messageTs)string ✦ (optional) — The timestamp (ts) of an existing message to edit instead of posting a new one.
Attachments (attachments)string ✦ (optional) — Files to upload with the message — a voice reply a Text to Speech node made, a report, an image.

Fields marked ✦ accept expressions.

Try this node — run it once against your own workspace, with your credentials, without building a flow first.

Attachments picks stored files. Type part of a path, and the field lists the matching files of every file store in your workspace as Store › path, the newest first, 50 at most. One picked file is saved as its object id, several as a JSON array, and a list typed in before the field became a picker opens as its files. For a file another node produced, such as a spoken reply, click Insert a value ({x}) and write an expression, for example {!! $prev->object->versionId !!}.

On a successful send the node emits:

{ "status": "sent", "channel": "slack" }

In bot-token mode and as a workspace bot, the output also says where the message went, so a later node can edit it with messageTs or answer in its thread with threadTs:

{ "status": "sent", "channel": "slack", "channelId": "C0123ABCD", "messageTs": "1700000000.000100" }

In webhook mode, any response status other than 200 fails the node. In the other two modes, the node also checks the response body: Slack answers logical failures with status 200 and an error field, and those fail the node too.

Create a Slack app, enable Incoming Webhooks, add a webhook to the Slack workspace, and choose the target channel. Copy the generated URL and save it as a secret in Publicus. Messages post fire-and-forget to the webhook’s channel; the channel, threadTs, and messageTs fields are ignored.

Give your Slack app a bot token with the chat:write scope, save the token as a secret (or as a Slack connection), and select it in credential. In this mode:

  • channel is required and must be the channel id (for example C0123ABCD), not the channel name. The bot must be a member of the channel.
  • Set threadTs to a parent message’s ts to post the reply inside that thread.
  • Set messageTs to a previously sent message’s ts to edit that message instead of posting a new one. When both are set, messageTs wins and the node edits the message.

Pick the bot under bot. threadTs and messageTs work as in bot-token mode. Where the message goes depends on channel:

channel The bot posts
Empty In the conversation whose message to this bot started the run, inside the thread that message was in. A run started any other way (a schedule, a form, another flow) has no conversation to answer, and fails.
A channel id (C…, G…) In that channel. When the connection lists Only in these channels, the channel must be one of them.
A user id (U…, W…) In a direct message to that person.

The bot writes directly only to the person whose message started the run, and to the people listed under May send direct messages to on its connection. A scheduled run has no such person, so to send yourself a morning summary, add your own Slack member id to that list. You find it in your Slack profile, under ⋮ → Copy member ID. A direct-message id (D…) works only for the conversation that started the run. To write to a person, use their user id.

Wired to a Form’s Send via handle, a new message sent as the bot also carries the form’s buttons, under the message’s blocks (or under its text, when you give no blocks). Pressing one answers the form from Slack, and the buttons then give way to a line naming what was chosen and by whom. A webhook, a bot token of the node’s own, an edit, or a message with files posts the link alone. See Answering from the chat message for when the buttons appear.

The Channel / Slack template is a minimal working webhook send: Start → Injector → Slack, with text set to {{ $prev->message }}.

Wire Agent → Slack:

  1. Set webhookUrl to {!! $secrets->slackWebhookUrl !!}.
  2. Set text to {!! $prev->content !!} (the Agent node emits its reply under content; the agent’s answer may contain characters that escaping would corrupt).

Post a scheduled summary to yourself (as a workspace bot)

Section titled “Post a scheduled summary to yourself (as a workspace bot)”
  1. Add your Slack member id under May send direct messages to on the bot’s connection.
  2. In the Slack node, pick the bot under bot and set channel to your member id.
  3. Set text to {!! $prev->content !!}.

Reply under the message that started the run

Section titled “Reply under the message that started the run”

A message to the bot carries its own timestamp as {{ $start->replyContext->ts }}. Pick the bot, leave channel empty, and set threadTs to that value to answer in a new thread under the message. Leave threadTs empty to answer in the channel, or in the thread the message was already in. See How to build a Slack agent for the full setup.

When an agent calls this node as a tool, the send is approval-gated by default; see How to add human approval.

  • Invalid JSON in blocks is silently ignored; the message still sends as plain text.
  • Threading and editing work in bot-token mode and as a workspace bot only.
  • A workspace bot posts only in the channels its connection lists, when it lists any, and writes directly only to the people above.
  • Slack treats <!channel> and <!everyone> in the text as mentions. When the text quotes someone else’s words, escape <, > and & first.