Portal Community

label/create

Create a new user-defined Gmail label for categorizing and routing messages in automated workflows.

When to Use

Configuration

Connection

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

Operation Fields

FieldTypeDefaultDescription
namestring requiredLabel display name. Must be unique in the account. Case-sensitive. Supports nesting with "/" separator (e.g. "Projects/Alpha").
labelListVisibilityenum optionallabelShowWhether the label appears in the Gmail label list: labelShow (visible), labelHide (hidden), labelShowIfUnread (visible only when messages are unread).
messageListVisibilityenum optionalshowWhether messages with this label appear in the message list: show or hide.

Sample Configuration

{
  "nodeType": "Gmail",
  "operation": "label/create",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "name": "BizFirst/Processed",
  "labelListVisibility": "labelShow",
  "messageListVisibility": "show"
}

Validation Errors

ErrorCauseResolution
MISSING_FIELD: nameLabel name is emptyProvide a non-empty label name
LABEL_ALREADY_EXISTSA label with this name already existsUse label/getMany to check for existing labels before creating; implement upsert logic
INVALID_LABEL_NAMELabel name contains invalid characters or is too longGmail label names must be under 225 characters and cannot contain certain special characters
INVALID_CREDENTIALOAuth token expired or credential not foundRe-authenticate in BizFirst Credentials Manager

Output

Success Port

FieldTypeDescription
labelIdstringGmail label ID (e.g. Label_987654321) — use this in message/addLabel and thread/addLabel operations
namestringLabel display name as stored
labelListVisibilitystringConfigured list visibility setting
messageListVisibilitystringConfigured message visibility setting
typestringuser for user-created labels
statusstringsuccess
errorCodestringEmpty on success

Error Port

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

Sample Output

{
  "labelId": "Label_987654321",
  "name": "BizFirst/Processed",
  "labelListVisibility": "labelShow",
  "messageListVisibility": "show",
  "type": "user",
  "status": "success",
  "errorCode": ""
}

Expression Reference

ExpressionResolves ToExample Use
{{labelCreate.labelId}}New label ID from this node's outputPass immediately to message/addLabel
{{project.name}}Project name from CRM or upstream dataDynamic label name: Projects/{{project.name}}
{{client.name}}Client name for per-client labelLabel name: Clients/{{client.name}}

Node Policies & GuardRails

PolicyRule
Idempotency CheckCheck for existing labels with label/getMany before creating — duplicate label names throw an error
Credential StorageStore OAuth credentials in BizFirst Credentials Manager — never hardcode tokens in workflow configuration
Label ID CaptureAlways store the returned labelId in a workflow variable for use in subsequent message/addLabel operations
Naming ConventionUse a consistent prefix (e.g. "BizFirst/") for workflow-created labels to distinguish them from manually created labels
Quota ManagementLabel create operations cost 1 quota unit — safe for frequent creation in provisioning workflows
Test IsolationTest label creation workflows against a dedicated Gmail test account; created labels persist and must be manually deleted after testing

Examples

Example 1: Workflow Initialization Label

At the start of an automated email processing workflow, ensure the "Processed" label exists (create it if not).

{
  "nodeType": "Gmail",
  "operation": "label/create",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "name": "BizFirst/Processed",
  "labelListVisibility": "labelShowIfUnread",
  "messageListVisibility": "show"
}

Example 2: New CRM Client Label

When a new client is added to the CRM, create a Gmail label for their email folder.

{
  "nodeType": "Gmail",
  "operation": "label/create",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "name": "Clients/{{crm.newClient.name}}",
  "labelListVisibility": "labelShow",
  "messageListVisibility": "show"
}

Example 3: Compliance Category Label

Create a GDPR-Request label for flagging emails that contain data subject access requests.

{
  "nodeType": "Gmail",
  "operation": "label/create",
  "credentialId": "a3f9d12b-44e1-4c89-b7d2-9f0a1e2b3c4d",
  "name": "Compliance/GDPR-Request",
  "labelListVisibility": "labelShow",
  "messageListVisibility": "show"
}