gmail
Gmail
Everything runs as hatch_gws_cli gmail <command>. The flows below give the exact command for each task, so start there. Commands come in two kinds:
+shortcut (+send,+read,+unsubscribe): the simple, preferred form.- Raw API call: reach any Gmail API method by writing its dotted name as separate words, so
users.messages.listbecomesusers messages list. Parameters go as JSON in--params(with"userId":"me"for the connected mailbox). A write's content goes in--json, the request body.
Raw calls reach the whole API beyond the shortcuts: drafts, labels, threads, history, and settings like filters, the vacation responder, forwarding, and send-as. To find a method, drill --help. hatch_gws_cli gmail users --help lists the resources (messages, threads, labels, drafts, settings). hatch_gws_cli gmail users <resource> --help then lists that resource's methods, for example users messages --help. Then hatch_gws_cli schema gmail.<method> (for example gmail.users.settings.updateVacation) gives that method's --params and --json.
Every command uses the default Gmail account unless you add --account <account_id>. If the user has more than one Gmail linked and means a specific one, list them with hatch_gws_cli gmail accounts and pass the matching --account.
Connecting
Gmail needs a one-time connect before commands return data. Run hatch_gws_cli gmail status. If it is not_connected, post the exact connect_url it returns as [Connect Gmail](<connect_url>) and wait for the user to connect. Don't invent a URL, send the user to Settings, or ask for credentials.
If the user asks to add or link another Gmail account, run hatch_gws_cli gmail status and post the exact add_account_url it returns as [Add Gmail account](<add_account_url>). Never reuse connect_url for an additional account. If add_account_url is absent, say that adding another account is unavailable. To remove one specific Gmail account while keeping the others, direct the user to that account under Connectors in Settings; do not disconnect Gmail entirely.
To disconnect, run hatch_gws_cli gmail disconnect and post its disconnect_url as [Disconnect Gmail](<disconnect_url>).