Skip to content

Slack Writer

Sends a message to Slack using a bot token. Supports plain text or rich Block Kit JSON with automatic fallback text for clients that don’t render blocks. Can post to channels, conversations, or open a direct message thread when a user ID is provided.
Preview

Usage

Use this node to post notifications, updates, or rich messages to Slack from your Salt pipelines. Provide a bot token, choose a destination (channel name, channel ID, or user ID), and optionally supply Block Kit JSON for rich formatting or a thread timestamp to reply in a thread.

Inputs

FieldRequiredTypeDescriptionExample
slack_tokenTruePASSWORDSlack Bot OAuth token used to authenticate requests. Must include scopes such as chat:write and, if customizing icons, chat:write.customize.
channelTrueSTRINGDestination in Slack. Accepts channel name (e.g., #general), channel ID (e.g., C0123456789), or user ID (e.g., U0123456789). If a user ID is supplied, the node opens a DM and posts there.#general
icon_emojiTrueSTRINGEmoji (e.g., :robot_face:) to use as the bot icon. Requires chat:write.customize permission. Leave empty to use the app’s default icon.:robot_face:
icon_urlTrueSTRINGURL of a custom bot icon (512x512 or smaller). Requires chat:write.customize permission. Ignored if icon_emoji is set.https://example.com/icon.png
thread_timestampTrueSTRINGSlack message timestamp to reply in a thread (e.g., 1734479286.246919). Leave empty to start a new top-level message.1734479286.246919
messageTrueSTRINGPlain text content of the message. If Block Kit JSON is provided, this is used as a fallback text (auto-generated if omitted).Hello from Salt AI!
block_kit_jsonTrueSTRINGA JSON array of Slack Block Kit objects for rich formatting. Must be valid JSON and an array of block objects.[{"type":"section","text":{"type":"mrkdwn","text":"Hello from Salt AI!"}}]

Outputs

FieldTypeDescriptionExample
statusSTRINGThe text content of the posted Slack message (final message text).Hello from Salt AI!
responseSTRINGRaw Slack API response serialized as a JSON string.{"ok": true, "channel": "C0123456789", "ts": "1734479286.246919", "message": {"text": "Hello from Salt AI!"}}
thread_timestampSTRINGThe Slack message timestamp (ts) of the posted message, useful for threading subsequent replies.1734479286.246919

Important Notes

  • Authentication: A valid Slack Bot OAuth token is required.
  • Scopes: chat:write is required; chat:write.customize is needed to use icon_emoji or icon_url.
  • Destinations: Provide #channel, C-channelID, or U-userID. When using a user ID, the node will open a DM with that user and post there.
  • Block Kit: block_kit_json must be a JSON array of blocks. If provided, a fallback text is auto-generated from the blocks for clients that can’t render blocks.
  • Threading: Provide thread_timestamp to reply within an existing thread. Omit it to post a top-level message.
  • Error Redaction: Any error messages will redact the provided token for safety.
  • Hidden Timeout: A hidden timeout parameter controls the Slack SDK request timeout (default 60s).

Troubleshooting

  • Invalid token or missing scopes: Ensure the token is correct and the app has chat:write (and chat:write.customize if customizing icons). Reinstall the app if scopes changed.
  • Cannot post to channel: Verify the bot is a member of the channel and that the channel/ID is correct. For private channels, invite the bot.
  • DM not delivered: If using a user ID, ensure the bot can open a DM with that user and that the user has not disabled DMs from the app.
  • Invalid Block Kit JSON: Ensure block_kit_json is valid JSON and a top-level array of block objects. Validate using Slack’s Block Kit Builder.
  • Thread timestamp rejected: Confirm the thread_timestamp corresponds to a valid message in the target channel and is properly formatted.
  • Rate limits or timeouts: Reduce message frequency, increase the hidden timeout, or implement retries with backoff outside this node.