slack.onMessagePosted emits top-level, ordinary messages authored by people and visible to the bot across public channels, private channels, DMs, and group DMs. It excludes thread replies, bot or app messages, edits, deletions, and Slack system-message subtypes.
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 can’t be a signal.
Trigger data
Returns message fields including optionaltext, timestamp, userId, and type: "message". Conversation, event timestamp, and workspace metadata are conversationId, conversationType, eventTimestamp, and workspaceId. conversationType is "channel", "group", "im", or "mpim". event contains the typed original Slack event and envelope contains the complete Events API callback.
Messages from a conversation outside the bot’s visibility don’t qualify. Use slack.onThreadReplyPosted for replies and slack.onEvent when you need every supported Slack event family.