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

# Reply to a message

> Send a reply to a specific Gmail message.

`reply` answers one Gmail message and keeps the response in its conversation.
Use it when you know exactly which message should determine the reply
recipient and conversation headers.

## Example

```ts automations/acknowledge-email.automation.ts theme={null}
import { automation } from "automate.ax"
import { onNewEmail, reply } from "automate.ax/gmail"

export default automation("Acknowledge new email", () => {
  const email = onNewEmail()

  reply({
    messageId: email.messageId,
    text: "Thanks for reaching out. We received your message.",
  })
})
```

Gmail sends the reply to the source message's Reply-To address when present,
otherwise to its From address. The source subject and RFC conversation headers
are preserved automatically.

## Inputs

| Input         | Type                                              | Required | Default               | Description                                                                                       |
| ------------- | ------------------------------------------------- | -------- | --------------------- | ------------------------------------------------------------------------------------------------- |
| `messageId`   | `string`                                          | Yes      | —                     | Immutable Gmail ID of the message receiving the reply.                                            |
| `replyAll`    | `boolean`                                         | No       | `false`               | Include original To and Cc recipients, excluding the connected account and primary reply address. |
| `html`        | `string`                                          | No       | None                  | HTML reply body.                                                                                  |
| `text`        | `string`                                          | No       | Derived from `html`   | Plain-text reply body.                                                                            |
| `to`          | `Recipient \| Recipient[]`                        | No       | None                  | Additional primary recipients appended to the derived recipient.                                  |
| `cc`          | `Recipient \| Recipient[]`                        | No       | None                  | Additional carbon-copy recipients.                                                                |
| `bcc`         | `Recipient \| Recipient[]`                        | No       | None                  | Additional blind-copy recipients.                                                                 |
| `from`        | `Recipient`                                       | No       | Gmail account address | Sender address or configured Gmail send-as alias.                                                 |
| `replyTo`     | `Recipient \| Recipient[]`                        | No       | None                  | Addresses that should receive replies to the outgoing reply.                                      |
| `attachments` | `Attachment[]`                                    | No       | `[]`                  | Files and inline MIME parts attached to the reply.                                                |
| `headers`     | `Record<string, string>`                          | No       | None                  | Additional RFC 5322 headers.                                                                      |
| `priority`    | `"high" \| "normal" \| "low"`                     | No       | Not set               | Importance encoded in standard message headers.                                                   |
| `account`     | `string \| IntegrationAccountReference<"google">` | No       | Project default       | Connected Google account used to send the reply.                                                  |

`Recipient` is an email string or `{ address: string; name?: string }`.
`Attachment` is a `File` or an object containing `file` with optional
`filename`, `contentId`, and `disposition: "attachment" | "inline"`.

Every input, including `account`, also accepts a compatible `Signal`.

<Warning>
  `replyAll: true` may notify every original To and Cc recipient. Leave it off
  for a private reply.
</Warning>

The action fails when the source message lacks a Gmail thread ID, subject, RFC
Message-ID, or both Reply-To and From headers.

## Output

Returns a `Signal<MessageMetadata>` with:

| Property    | Type                  | Description                                                       |
| ----------- | --------------------- | ----------------------------------------------------------------- |
| `messageId` | `string`              | Immutable Gmail ID of the sent reply.                             |
| `threadId`  | `string`              | Gmail thread containing the source message and reply.             |
| `historyId` | `string \| undefined` | Latest mailbox history record affecting the reply, when supplied. |
| `labelIds`  | `string[]`            | Labels applied to the sent reply.                                 |
