Gmail — Remove label
Gmail — Remove label
Section titled “Gmail — Remove label”Type: gmail-remove-label · Package: Gmail v1.0.4 · Output: —
Removes one or more labels from an email. It is the inverse of Apply label: use it, for example, to remove Pending once the case is solved.
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.
- Give the labels by name (case-insensitive) or by ID; look them up with Get labels.
- Each label must exist in the mailbox; if one doesn’t, it fails without removing any.
- Removing a label the email doesn’t have changes nothing and does not fail.
- System labels can be removed too:
INBOXis the same as archiving andUNREADthe same as marking as read.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | — | Message ID. |
labels | string | List | — | Label name(s) or ID(s) to remove: text separated by commas or semicolons, or a list. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanGmailSession | — | Gmail — Connect session (inherited inside body). |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
Label not found. Use an existing label name or ID. | A label does not exist in the mailbox. Check the name with Get labels. |
'labels' is required. | labels is empty. |
'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”Gmail — Connect credential = credential("gmail-support") └─ body: Gmail — Get emails query = "label:Pending subject:solved" → output: solved For each email in solved └─ Gmail — Remove label id = email["id"] labels = "Pending" Gmail — Apply label id = email["id"] labels = "Solved"Related activities
Section titled “Related activities”- Gmail — Apply label — apply a label.
- Gmail — Get labels — list the mailbox labels.
- Gmail — Get emails — find the emails.
- All Gmail activities