> ## 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 chat message posted

> Start an automation when a message is posted in one Teams chat.

`onChatMessagePosted` watches one existing one-to-one, group, or meeting chat.

## Example

```ts automations/watch-teams-chat.automation.ts theme={null}
import { automation } from "automate.ax"
import { onChatMessagePosted, sendChatMessage } from "automate.ax/teams"

export default automation("Watch Teams chat", () => {
  const message = onChatMessagePosted({ chatId: "19:opaque-chat-id@thread.v2" })
  sendChatMessage({ chatId: message.chatId, body: "Message received." })
})
```

## Options

Required `chatId: string` is the opaque Graph chat ID. Optional static `account`
defaults to the project Microsoft binding. Neither can be chosen from a runtime
signal.

## Trigger data

Returns `TeamsChatMessage & { chatId: string }`, including body, message ID,
sender, timestamps, attachments, mentions, reactions, importance, reply parent,
subject, summary, locale, URL, and ETag when supplied by Graph.
