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

> Runs when a message is created and returns the message change event.

`outlook.onMessageCreated` subscribes to Microsoft Graph mailbox notifications.

## Example

```ts automations/outlook-on-message-created.automation.ts theme={null}
import { automation } from "automate.ax"
import { outlook } from "automate.ax/outlook"

export default automation("On message created", () => {
  const event = outlook.onMessageCreated({ folder: "Customers" })
  return event
})
```

## Options

Optional `folder` accepts an exact display path, provider ID, or well-known name. Omit it to watch the mailbox. Optional `account` selects a Microsoft binding.

## Event

Runs when a message is created and returns the message change event. Created and updated events include the normalized message. Deleted events include `changeType`, `messageId`, and the known `folderId` without fetching the deleted resource.
