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

# Is unread

> Check whether a Gmail message is currently unread.

`isUnread` checks whether one Gmail message has the `UNREAD` system label. Use it when later work should run only for mail that is still unread.

## Example

Mark each newly received message as read only if it remains unread when the action runs:

```ts theme={null}
import { automation, branch } from "automate.ax"
import { isUnread, markAsRead, onNewEmail } from "automate.ax/gmail"

export default automation("Read new Gmail messages", () => {
  const email = onNewEmail()
  const unread = isUnread({ messageId: email.messageId })

  branch(unread, () => {
    markAsRead({ messageIds: email.messageId })
  })
})
```

## Inputs

| Name        | Type                                 | Required | Description                                                                      |
| ----------- | ------------------------------------ | -------- | -------------------------------------------------------------------------------- |
| `messageId` | `string`                             | Yes      | Immutable Gmail message ID to inspect.                                           |
| `account`   | `string \| Google account reference` | No       | Google account binding to use. Defaults to the project's default Google account. |

Every input field also accepts a compatible `Signal`; the example passes `email.messageId` directly.

## Output

The action returns a `Signal<boolean>` indicating whether the message has Gmail's `UNREAD` label when the action runs.

Read state is message-level. In a conversation, other messages in the same thread can have a different state.
