Gmail — Get labels
Gmail — Get labels
Section titled “Gmail — Get labels”Type: gmail-get-labels · Package: Gmail v1.0.4 · Output: List<Dictionary<string,object>>
Lists the mailbox labels (system ones such as INBOX or UNREAD and custom ones). Use it to find a label’s ID before filtering with labelIds, or to check that a label exists before applying 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.
It returns every label in a single call; it changes nothing.
Required parameters
Section titled “Required parameters”None.
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanGmailSession | — | Gmail — Connect session (inherited inside body). |
Output
Section titled “Output”Returns a List<Dictionary<string,object>>: one item per label, with these keys.
| Key | Type | Content |
|---|---|---|
id | string | Label ID. System labels use their name (INBOX, SENT, UNREAD, STARRED, IMPORTANT, SPAM, TRASH, CATEGORY_PROMOTIONS…); custom ones, an ID such as Label_123. |
name | string | Display name. Nested labels include the path: Suppliers/Invoices. |
type | string | system or user. |
Loop over it with For each and read by key, for example label["name"] or label["id"].
Common errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
No Gmail session available. … | You didn’t pass session and the activity is not inside Connect’s body. |
Example
Section titled “Example”Find a label’s ID by its name and use it as a filter:
Gmail — Connect credential = credential("gmail-support") └─ body: Gmail — Get labels → output: labels For each label in labels └─ If condition = str(label["name"]) == "Suppliers" └─ Set Variable name = suppliersId value = label["id"] Gmail — Get emails labelIds = suppliersId query = "is:unread" → output: emailsRelated activities
Section titled “Related activities”- Gmail — Apply label — apply a label.
- Gmail — Remove label — remove a label.
- Gmail — Get emails — filter by label with
labelIds. - All Gmail activities