> ## Documentation Index
> Fetch the complete documentation index at: https://docs.automate.ax/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# On message posted

> Start an automation when Slack posts a visible message.

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

## Example

```ts automations/react-to-new-slack-message.automation.ts theme={null}
import { automation } from "automate.ax"
import { addReaction, onMessagePosted } from "automate.ax/slack"

export default automation("React to Slack messages", () => {
  const event = onMessagePosted()
  addReaction({
    conversationId: event.conversationId,
    emoji: "eyes",
    timestamp: event.message.timestamp,
  })
})
```

## 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.
