Portal Community

thread/addLabel

Add one or more labels to ALL messages in a Gmail thread simultaneously.

Thread-Wide Operation: Unlike message/addLabel which targets a single message, thread/addLabel applies the specified labels to every message in the thread in a single API call — more efficient for conversation-level categorization.

When to Use

Configuration

Connection

FieldTypeDescription
credentialIdGuid requiredOAuth2 credential ID from BizFirst Credentials Manager. Requires gmail.modify scope.

Operation Fields

FieldTypeDefaultDescription
threadIdstring requiredGmail thread ID. Labels are applied to every message in this thread.
labelIdsstring[] requiredArray of label IDs to add to all messages in the thread. Supports system labels and user label IDs.

Sample Configuration

{
  "nodeType": "Gmail",
  "operation": "thread/addLabel",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "threadId": "{{processedThread.threadId}}",
  "labelIds": ["{{workflow.processedLabelId}}", "STARRED"]
}

Validation Errors

ErrorCauseResolution
MISSING_FIELD: threadIdthreadId is emptyProvide a valid thread ID
MISSING_FIELD: labelIdslabelIds is empty arrayProvide at least one label ID
INVALID_LABEL_IDOne or more label IDs do not existResolve label IDs with label/getMany before using
THREAD_NOT_FOUNDThread does not exist in the accountVerify thread ID comes from the authenticated account
INVALID_CREDENTIALOAuth token expired or credential not foundRe-authenticate in BizFirst Credentials Manager

Output

Success Port

FieldTypeDescription
successbooltrue when labels were successfully applied to all thread messages
statusstringsuccess
errorCodestringEmpty on success

Error Port

On failure, routes to the error port with status: "error", errorCode, and errorMessage.

Sample Output

{
  "success": true,
  "status": "success",
  "errorCode": ""
}

Expression Reference

ExpressionResolves ToExample Use
{{processedThread.threadId}}Thread ID from upstream processing nodethreadId field
{{workflow.processedLabelId}}Label ID resolved from label/getMany at workflow startlabelIds array element
{{classification.departmentLabelId}}Department label ID from classification outputDynamic label routing

Node Policies & GuardRails

PolicyRule
Label ID ResolutionAlways resolve user label IDs with label/getMany at workflow start — never hardcode user label IDs
Thread-Wide ImpactLabels are applied to ALL messages in the thread — verify the correct thread is targeted before applying sensitive labels
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
IdempotencyAdding a label that is already applied to all thread messages is a no-op — safe to call multiple times
Quota ManagementThread label operations cost 1–5 quota units — safe for batch workflows using a Loop node
Test IsolationTest thread labeling against a dedicated Gmail test account before connecting production

Examples

Example 1: Thread Processing State Label

After syncing all messages from a thread to the CRM, apply a "CRM-Synced" label to the entire conversation.

{
  "nodeType": "Gmail",
  "operation": "thread/addLabel",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "threadId": "{{crmSync.threadId}}",
  "labelIds": ["{{labelLookup.crmSyncedLabelId}}"]
}

Example 2: Priority Escalation Thread Flag

Mark an entire escalated conversation as STARRED and IMPORTANT for high visibility.

{
  "nodeType": "Gmail",
  "operation": "thread/addLabel",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "threadId": "{{escalation.threadId}}",
  "labelIds": ["STARRED", "IMPORTANT"]
}

Example 3: Project Thread Association

When a conversation is linked to a project in the project management tool, apply the project label to the entire thread.

{
  "nodeType": "Gmail",
  "operation": "thread/addLabel",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "threadId": "{{project.linkedThreadId}}",
  "labelIds": ["{{labelLookup.projectLabelId}}"]
}