Portal Community

thread/removeLabel

Remove one or more labels from ALL messages in a Gmail thread simultaneously.

Thread-Wide Operation: thread/removeLabel removes the specified labels from every message in the thread in a single API call — more efficient than calling message/addLabel on each message individually.

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 removed from every message in this thread.
labelIdsstring[] requiredArray of label IDs to remove from all messages in the thread.

Sample Configuration

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

Validation Errors

ErrorCauseResolution
MISSING_FIELD: threadIdthreadId is emptyProvide a valid thread ID
MISSING_FIELD: labelIdslabelIds is empty arrayProvide at least one label ID to remove
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 removed from 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
{{completedTask.threadId}}Thread ID from completed task eventthreadId field
{{labelLookup.inProgressLabelId}}In-Progress label ID from label/getMany lookuplabelIds element to remove
{{reroutedThread.threadId}}Thread ID for re-routing operationRemove old department label before adding new one

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 removed from ALL messages in the thread — verify the correct thread is targeted
IdempotencyRemoving a label that is not applied to thread messages is a no-op — safe to call multiple times
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
Quota ManagementThread label operations cost 1–5 quota units — safe for batch workflows
Test IsolationTest thread label operations against a dedicated Gmail test account before connecting production

Examples

Example 1: Status Label Transition

Remove "Pending-Review" label from entire thread after review is complete, then add "Reviewed" label.

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

Example 2: Department Re-routing

Remove incorrect Finance label from a thread that was mis-routed, before applying the correct Support label.

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

Example 3: Priority De-escalation

After an escalation is resolved, remove STARRED and IMPORTANT from the thread.

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