Gmail — Archive
Gmail — Archive
Section titled “Gmail — Archive”Type: gmail-archive · Package: Gmail v1.0.4 · Output: —
Archives an email: takes it out of the inbox without deleting it. The email stays in All Mail, with its labels, and shows up in searches. It is the usual way to keep the inbox clean after processing an email, without losing track of it.
How it works
Section titled “How it works”It works on the session created with Gmail — Connect. Pass it in the session parameter, or place this activity inside the body of Gmail — Connect to inherit it automatically.
By default it archives the email (removes the INBOX label). Turn on unarchive to do the opposite: move it back to the inbox (adds INBOX). It is idempotent: archiving an already-archived email changes nothing and does not fail. The email’s id doesn’t change, so you can keep working on it afterwards.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | — | Message ID. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanGmailSession | — | Gmail — Connect session (inherited inside body). |
unarchive | bool | false | If true, moves the email back to the inbox; if false, archives it. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'id' is required. | id is empty or the expression returned null. |
Requested entity was not found. | No email with that ID exists in the mailbox. |
Example
Section titled “Example”Process new requests, label them and take them out of the inbox:
Gmail — Connect credential = credential("gmail-support") └─ body: Gmail — Get emails query = "in:inbox subject:request" → output: requests For each email in requests └─ Gmail — Apply label id = email["id"] labels = "Processed" Gmail — Archive id = email["id"]Related activities
Section titled “Related activities”- Gmail — Apply label — label the email before archiving it.
- Gmail — Mark read/unread — mark it as read.
- Gmail — Delete — move it to Trash.
- All Gmail activities