Skip to main content
gmail.onMailboxChanged is the broad Gmail history trigger. Use it when one automation must handle message additions, permanent deletions, label additions, and label removals.

Example

automations/audit-mailbox.automation.ts

Options

account is a static Google Account binding and defaults to the project binding. It can’t change at runtime.

Trigger data

Returns a discriminated union with changeType:
Added messages and label changes contain the parsed message shape from Get message. Permanently deleted messages contain stable IDs because Gmail can no longer return the message. Moving a message to Trash is a label change, not a permanent deletion. Use the dedicated semantic triggers when one lifecycle is sufficient.