Skip to main content
onMessagePosted subscribes to newly posted messages visible to the installed bot across public channels, private channels, DMs, and group DMs.

Example

automations/react-to-new-slack-message.automation.ts

Options

account?: string | IntegrationAccountReference<"slack"> statically selects the workspace and defaults to the project’s Slack binding. It cannot be a signal.

Trigger data

Returns conversationId, optional conversationType, eventTimestamp, workspaceId, and message: SlackMessage. SlackMessage contains text, timestamp, and type, with available author, thread, Block Kit, attachment, file, reaction, reply, app, bot, and subtype metadata. Messages from a conversation the bot cannot see do not qualify. This broad trigger includes thread replies; inspect message.threadTimestamp when your automation only wants top-level posts.