Outlook - Message Category
Apply Outlook categories (labels) to messages via the Microsoft Graph API.
Applies Outlook categories (labels) to a message without removing the existing ones, and can create them in the mailbox's master category list with a color. It works on one mailbox by message id, or fans out across several mailboxes by Internet Message ID or conversation.
Categories live in the user master list and can be applied to messages with a merge-safe PATCH that preserves categories already set by humans or other automations.
Operations:
- apply: Apply one or more categories to an existing message. Merges with existing categories (does not overwrite).
- ensure_master_category: Create one or more categories in the user master list. Idempotent: returns success if the category already exists.
- apply_with_ensure: Combination of the two. Recommended for workflows that should self-bootstrap their categories.
How it works
- Resolves the node config, requires
connection_idand gets a Graph token (app-only withclient_id,client_secret,tenant_id, or the storedtoken/access_token). Every request asks for immutable ids (Prefer: IdType="ImmutableId"). - Normalizes
categoriesfrom a comma-separated string, an array of names or an array of{ name, color }; items without a color usecategory_color. - Single-mailbox mode applies when there is one mailbox (or
mailbox_modeistoken_owner) and neitherinternet_message_idnorconversation_idis set: it works onmessage_iddirectly. - Otherwise it fans out over
mailbox_email(array or comma-separated list). Withinternet_message_idandmatch_scope: conversationit first probes the mailboxes for the conversation id; then, in parallel per mailbox, it resolves the local messages (the conversation's messages, up to 50, or withmatch_scope: messageonly the exact Internet Message ID copies, up to 10), retryingresolve_max_attemptstimes withresolve_wait_msbetween attempts. ensure_master_categorycreates each category in the master list; an existing one is accepted and its color is corrected when it differs.applyreads the message's categories, merges the new ones without duplicates and PATCHes them, retrying 412 (change key), 429 (honouringRetry-After) and 404 up topatch_max_attempts.apply_with_ensureruns both.- With
mark_read, marks the resolved messages as read (best effort). Chooseserrorwhen every mailbox failed, or whenrequire_applyis set and nothing was labeled; otherwiseout.
In a workflow
The node as it appears in a workflow file (draft_nodes[]), and the envelope of a successful run.
{
"node_id": "node-label-processed",
"label": "Label as processed",
"operator_slug": "connectors.microsoft.outlook.message.category",
"operator_version": "1.0.0",
"config": {
"connection_id": "pi-credential-xxxx",
"mailbox_mode": "other",
"mailbox_email": "[email protected]",
"operation": "apply_with_ensure",
"message_id": "{{ $json.id }}",
"categories": [
{
"name": "Processed",
"color": "preset4"
}
],
"category_color": "preset8"
}
}{
"ok": true,
"data": {
"result": {
"operation": "apply_with_ensure",
"message_id": "AAkALgAAAAAAHYQDEapmEc2byACqAC-EWg0A",
"applied": [
"Processed"
],
"preserved": [
"Customer"
],
"final_categories": [
"Customer",
"Processed"
],
"master_category_ensured": true,
"ensured": [],
"already_existed": [
"Processed"
],
"permission_denied": []
}
},
"port": "out"
}Configuration
-
connection_idstring Required -
Credential for Microsoft Graph API access. Requires `Mail.ReadWrite` (for PATCH /messages/{id}) and `MailboxSettings.ReadWrite` (for POST /outlook/masterCategories). Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).
-
mailbox_modestring Optional -
Token owner: uses the mailbox of the account that generated the credential. Other mailbox: specify an email address (requires Application permissions in Azure AD).
-
mailbox_emailany Optional Accepts expressions -
Single email or array/comma-separated list of mailboxes to operate on. When more than one is provided, the worker fans out and applies the categories in every mailbox that contains the same message (matched by internetMessageId).
-
internet_message_idstring Optional Accepts expressions -
RFC-5322 Internet Message ID of the email (e.g., <[email protected]>). Required for multi-mailbox mode: the worker uses it to find the local message id in each mailbox via $filter=internetMessageId eq. When omitted and a single mailbox is provided, the worker falls back to the legacy single-mailbox flow using `message_id` directly.
-
operationstring Required -
apply: apply categories to an existing message (merge-safe). ensure_master_category: create categories in the user master list (idempotent). apply_with_ensure: ensure + apply in one call (recommended).
-
message_idstring Optional Accepts expressions -
Graph message ID of the email to categorize.
-
categoriesarray<string | object> Optional Accepts expressions -
Categories to apply or ensure. Accepts: an array of display-name strings, a comma-separated string, OR an array of { name, color } objects to set a distinct color per category (e.g. [{name:"Recibido por IA - Sommatic",color:"preset8"},{name:"Asignado DAUITA",color:"preset4"}]). When an item has no color, the node-level category_color is used.
-
category_colorstring Optional -
Outlook category color preset. Required for ensure_master_category and apply_with_ensure (ignored by apply). Common values: preset0 (Red), preset8 (Purple), preset23 (Dark Purple - closest to Sommatic AI corporate #2A213B). Use "none" for no color.
-
match_scopestring Optional -
conversation (default): an internet_message_id is probed and expanded to the WHOLE thread (labels original + replies/forwards). message: resolve ONLY the exact internet_message_id matches (the reply/forward copy) — never expand to the conversation. Use "message" to label/mark-read a specific IA-generated copy without touching the citizen original.
-
mark_readboolean Optional -
After labeling, PATCH { isRead:true } on every resolved message. Scope it to IA-generated copies only (via match_scope:"message" or by targeting the forward_recipient mailbox); never point a mark_read node at the citizen original, which must stay unread.
-
resolve_max_attemptsnumber Optional -
Bounded retry on the message-resolution query. Absorbs Graph indexing latency of a just-sent reply/forward copy (a "success that resolved 0 messages" does not re-fire the node retry). Use e.g. 6 for IA-copy nodes; leave 1 for legacy calls.
-
resolve_wait_msnumber Optional -
Delay between resolution attempts in milliseconds (e.g. 1500). Only relevant when resolve_max_attempts > 1.
-
require_applyboolean Optional -
When true, emit port:"error" if nothing was labeled after all retries (instead of a silent success). Lets the caller drive a fallback branch (e.g. a notice + human task).
Its configuration shows the shared execution settings, but this node does not apply retries (retryOnFail, maxTries) yet. continueOnFail is not applied by any node.
Behaviour in the code
What the implementation does with these keys beyond what the schema says.
-
patch_max_attemptsRead by the code, not declared - Undeclared. Attempts for each category PATCH (default 4, minimum 1).
patch_wait_ms(undeclared, default 500) is multiplied by the attempt number between tries, unless Graph sendsRetry-After. -
conversation_idRead by the code, not declared - Undeclared in the config schema (only in the input contract). When set, it is used directly as the thread to label and the probe by Internet Message ID is skipped; it also switches to multi mode.
-
mailbox_email - Read only when
mailbox_modeisother. Accepts one address, an array or a comma-separated list; more than one address switches to multi mode. -
category_color - Outlook preset (
preset0…preset24) ornone. Ignored byapply. A per-itemcolorincategoriestakes precedence. -
mark_read - In single mode it marks
message_idas read; in multi mode every resolved message. Withmatch_scope: conversationthat includes the whole thread, so usematch_scope: messageto mark only one copy.
Output ports
out default Single mode: the categories were applied or already present. Multi mode: at least one mailbox did not fail; the output is then { result: { operation, mode: "multi_mailbox", conversation_id_resolved, mailboxes_total, applied_in, messages_per_mailbox, messages_read_by_mailbox, not_found_in, permission_denied_in, errored_in, conflict_in, any_applied, any_conflict } }.
{
"result": {
"operation": "apply_with_ensure",
"message_id": "AAkALgAAAAAAHYQDEapmEc2byACqAC-EWg0A",
"applied": [
"Processed"
],
"preserved": [
"Customer"
],
"final_categories": [
"Customer",
"Processed"
],
"master_category_ensured": true,
"ensured": [],
"already_existed": [
"Processed"
],
"permission_denied": []
}
}error A validation failed (the output is the envelope { ok, errors, port }), a Graph call failed in single mode ({ error, response }), or in multi mode every mailbox failed or require_apply found nothing labeled (the multi-mailbox result).
{
"ok": false,
"errors": [
"At least one category is required for apply operation"
],
"port": "error"
}In expressions
What a later node can read from this node's output with $("Outlook - Message Category").item.json.<path> (write your node's label instead of Outlook - Message Category). Editor marks the paths the workflow editor suggests under Previous Nodes (the output contract); Worker marks the paths the worker really returns through out, from the output shown in Ports.
| Expression | Editor | Worker |
|---|---|---|
$("Outlook - Message Category").item.json.result | ||
$("Outlook - Message Category").item.json.result.operation | ||
$("Outlook - Message Category").item.json.result.message_id | ||
$("Outlook - Message Category").item.json.result.appliedCategories newly added to the message. | ||
$("Outlook - Message Category").item.json.result.preservedCategories that were already on the message and were preserved. | ||
$("Outlook - Message Category").item.json.result.final_categoriesFinal categories on the message after the operation. | ||
$("Outlook - Message Category").item.json.result.ensuredCategories created in the master list. | ||
$("Outlook - Message Category").item.json.result.already_existedCategories that already existed in the master list. | ||
$("Outlook - Message Category").item.json.result.master_category_ensured | ||
$("Outlook - Message Category").item.json.result.conversation_id_resolvedThread id used to resolve messages (multi-mailbox mode). | — | |
$("Outlook - Message Category").item.json.result.messages_per_mailboxCount of messages labeled per mailbox. | — | |
$("Outlook - Message Category").item.json.result.messages_read_by_mailboxCount of messages marked read (isRead:true) per mailbox, when mark_read is set. | — | |
$("Outlook - Message Category").item.json.result.permission_denied | — |
— Editor: The editor suggests it, but the worker does not return it: it reads as undefined.
— Worker: The worker returns it but the editor does not suggest it: write it by hand. Keys inside objects can depend on your data or configuration (for example one key per label).
Errors
| Message | Port | Cause and fix |
|---|---|---|
Microsoft 365 credential is required | error | connection_id is empty. |
Failed to resolve Microsoft 365 access token | error | The credential could not be resolved or the token request failed. |
Message ID is required for apply operation | error | Single mode without message_id. |
At least one category is required for apply operation | error | categories is empty. For ensure_master_category the message is At least one category displayName is required. |
Failed to ensure master category '<name>': <Graph message> | error | Creating the category failed for a reason other than "already exists" or a permission error. |
Unknown operation: <operation> | error | operation is not apply, ensure_master_category or apply_with_ensure (single mode). |
No messages could be labeled in this mailbox: <reason> | error | Multi mode: reported per mailbox inside errored_in (or conflict_in for change-key conflicts that survived the retries). |
Input contract
-
connection_idstring Required -
operationstring Required -
message_idstring Optional -
internet_message_idstring Optional -
conversation_idstring Optional -
categoriesarray<string> Optional -
category_colorstring Optional -
match_scopestring Optional -
mark_readboolean Optional -
resolve_max_attemptsnumber Optional -
resolve_wait_msnumber Optional -
require_applyboolean Optional
Output contract
-
resultobject Optional -
-
operationstring Optional -
message_idstring Optional -
appliedarray<string> Optional -
Categories newly added to the message.
-
preservedarray<string> Optional -
Categories that were already on the message and were preserved.
-
final_categoriesarray<string> Optional -
Final categories on the message after the operation.
-
ensuredarray<string> Optional -
Categories created in the master list.
-
already_existedarray<string> Optional -
Categories that already existed in the master list.
-
master_category_ensuredboolean Optional -
conversation_id_resolvedstring Optional -
Thread id used to resolve messages (multi-mailbox mode).
-
messages_per_mailboxobject Optional -
Count of messages labeled per mailbox.
-
messages_read_by_mailboxobject Optional -
Count of messages marked read (isRead:true) per mailbox, when mark_read is set.
-
Contracts (JSON Schema)
The definition exactly as the orchestrator declares it. All is the whole *.definition.js; compare it with the sections above to spot differences between the documentation and the schema. Use it to validate a node before you publish.
{
"slug": "connectors.microsoft.outlook.message.category",
"name": "Outlook - Message Category",
"category": "integrations",
"version": "1.0.0",
"description": "Apply Outlook categories (labels) to messages via the Microsoft Graph API.\n\n Categories live in the user master list and can be applied to messages with a merge-safe PATCH that preserves categories already set by humans or other automations.\n\n **Operations:**\n - **apply:** Apply one or more categories to an existing message. Merges with existing categories (does not overwrite).\n - **ensure_master_category:** Create one or more categories in the user master list. Idempotent: returns success if the category already exists.\n - **apply_with_ensure:** Combination of the two. Recommended for workflows that should self-bootstrap their categories.",
"capabilities": [
"email",
"microsoft",
"outlook",
"office365",
"graph-api",
"category",
"label"
],
"group": [
{
"key": "microsoft",
"name": "Microsoft",
"icon_url": "/icons/integrations/microsoft/microsoft.svg"
},
{
"key": "microsoft365",
"name": "Microsoft 365",
"icon_url": "/icons/integrations/microsoft/microsoft365.svg"
}
],
"icon_url": "/icons/integrations/microsoft/outlook.svg",
"config_schema": {
"type": "object",
"properties": {
"connection_id": {
"type": "string",
"title": "Microsoft 365 Credential",
"description": "Credential for Microsoft Graph API access. Requires `Mail.ReadWrite` (for PATCH /messages/{id}) and `MailboxSettings.ReadWrite` (for POST /outlook/masterCategories). Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).",
"ui_widget": "connection_picker",
"ui_options": {
"credential_types": [
"oauth2",
"service-account",
"object"
],
"types": [
"outlook",
"microsoft365",
"oauth2"
]
}
},
"mailbox_mode": {
"type": "string",
"title": "Mailbox",
"enum": [
"token_owner",
"other"
],
"default": "token_owner",
"description": "Token owner: uses the mailbox of the account that generated the credential. Other mailbox: specify an email address (requires Application permissions in Azure AD)."
},
"mailbox_email": {
"title": "Mailbox Email(s)",
"description": "Single email or array/comma-separated list of mailboxes to operate on. When more than one is provided, the worker fans out and applies the categories in every mailbox that contains the same message (matched by internetMessageId).",
"format": "expression",
"displayOptions": {
"show": {
"mailbox_mode": [
"other"
]
}
}
},
"internet_message_id": {
"type": "string",
"title": "Internet Message ID",
"description": "RFC-5322 Internet Message ID of the email (e.g., <[email protected]>). Required for multi-mailbox mode: the worker uses it to find the local message id in each mailbox via $filter=internetMessageId eq. When omitted and a single mailbox is provided, the worker falls back to the legacy single-mailbox flow using `message_id` directly.",
"format": "expression",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"operation": {
"type": "string",
"title": "Operation",
"enum": [
"apply",
"ensure_master_category",
"apply_with_ensure"
],
"default": "apply_with_ensure",
"description": "apply: apply categories to an existing message (merge-safe). ensure_master_category: create categories in the user master list (idempotent). apply_with_ensure: ensure + apply in one call (recommended)."
},
"message_id": {
"type": "string",
"title": "Message ID",
"description": "Graph message ID of the email to categorize.",
"format": "expression",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"categories": {
"type": "array",
"title": "Categories",
"items": {
"type": [
"string",
"object"
]
},
"description": "Categories to apply or ensure. Accepts: an array of display-name strings, a comma-separated string, OR an array of { name, color } objects to set a distinct color per category (e.g. [{name:\"Recibido por IA - Sommatic\",color:\"preset8\"},{name:\"Asignado DAUITA\",color:\"preset4\"}]). When an item has no color, the node-level category_color is used.",
"format": "expression"
},
"category_color": {
"type": "string",
"title": "Category Color",
"enum": [
"preset0",
"preset1",
"preset2",
"preset3",
"preset4",
"preset5",
"preset6",
"preset7",
"preset8",
"preset9",
"preset10",
"preset11",
"preset12",
"preset13",
"preset14",
"preset15",
"preset16",
"preset17",
"preset18",
"preset19",
"preset20",
"preset21",
"preset22",
"preset23",
"preset24",
"none"
],
"description": "Outlook category color preset. Required for ensure_master_category and apply_with_ensure (ignored by apply). Common values: preset0 (Red), preset8 (Purple), preset23 (Dark Purple - closest to Sommatic AI corporate #2A213B). Use \"none\" for no color.",
"displayOptions": {
"show": {
"operation": [
"ensure_master_category",
"apply_with_ensure"
]
}
}
},
"match_scope": {
"type": "string",
"title": "Match Scope",
"enum": [
"conversation",
"message"
],
"default": "conversation",
"description": "conversation (default): an internet_message_id is probed and expanded to the WHOLE thread (labels original + replies/forwards). message: resolve ONLY the exact internet_message_id matches (the reply/forward copy) — never expand to the conversation. Use \"message\" to label/mark-read a specific IA-generated copy without touching the citizen original.",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"mark_read": {
"type": "boolean",
"title": "Mark as Read",
"default": false,
"description": "After labeling, PATCH { isRead:true } on every resolved message. Scope it to IA-generated copies only (via match_scope:\"message\" or by targeting the forward_recipient mailbox); never point a mark_read node at the citizen original, which must stay unread.",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"resolve_max_attempts": {
"type": "number",
"title": "Resolve Max Attempts",
"default": 1,
"description": "Bounded retry on the message-resolution query. Absorbs Graph indexing latency of a just-sent reply/forward copy (a \"success that resolved 0 messages\" does not re-fire the node retry). Use e.g. 6 for IA-copy nodes; leave 1 for legacy calls.",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"resolve_wait_ms": {
"type": "number",
"title": "Resolve Wait (ms)",
"default": 0,
"description": "Delay between resolution attempts in milliseconds (e.g. 1500). Only relevant when resolve_max_attempts > 1.",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"require_apply": {
"type": "boolean",
"title": "Require Apply",
"default": false,
"description": "When true, emit port:\"error\" if nothing was labeled after all retries (instead of a silent success). Lets the caller drive a fallback branch (e.g. a notice + human task).",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
},
"required": [
"connection_id",
"operation"
]
},
"input_contract_schema": {
"type": "object",
"properties": {
"connection_id": {
"type": "string"
},
"operation": {
"type": "string"
},
"message_id": {
"type": "string"
},
"internet_message_id": {
"type": "string"
},
"conversation_id": {
"type": "string"
},
"categories": {
"type": "array",
"items": {
"type": "string"
}
},
"category_color": {
"type": "string"
},
"match_scope": {
"type": "string",
"enum": [
"conversation",
"message"
]
},
"mark_read": {
"type": "boolean"
},
"resolve_max_attempts": {
"type": "number"
},
"resolve_wait_ms": {
"type": "number"
},
"require_apply": {
"type": "boolean"
}
},
"required": [
"connection_id",
"operation"
]
},
"output_contract_schema": {
"type": "object",
"properties": {
"result": {
"type": "object",
"properties": {
"operation": {
"type": "string"
},
"message_id": {
"type": "string"
},
"applied": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories newly added to the message."
},
"preserved": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories that were already on the message and were preserved."
},
"final_categories": {
"type": "array",
"items": {
"type": "string"
},
"description": "Final categories on the message after the operation."
},
"ensured": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories created in the master list."
},
"already_existed": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories that already existed in the master list."
},
"master_category_ensured": {
"type": "boolean"
},
"conversation_id_resolved": {
"type": "string",
"description": "Thread id used to resolve messages (multi-mailbox mode)."
},
"messages_per_mailbox": {
"type": "object",
"description": "Count of messages labeled per mailbox."
},
"messages_read_by_mailbox": {
"type": "object",
"description": "Count of messages marked read (isRead:true) per mailbox, when mark_read is set."
}
}
}
}
},
"ports": [
{
"port_id": "out",
"label": "Success",
"description": "Category operation completed successfully.",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Operation failed (auth error, invalid message ID, API error).",
"is_default": false,
"supports_condition": true
}
],
"execution_mode": "async",
"required_resources": [],
"compatible_worker_pools": [
"standard-io",
"cloud-io"
],
"tags": [
"email",
"microsoft",
"outlook",
"office365",
"category",
"label",
"connector"
],
"is_stateful": false,
"publisher": {
"identity": "org_sommatic_ai",
"profile": {
"name": "Sommatic AI",
"verified": true,
"url": "https://me.veripass.com/sommatic",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"connection_id": {
"type": "string",
"title": "Microsoft 365 Credential",
"description": "Credential for Microsoft Graph API access. Requires `Mail.ReadWrite` (for PATCH /messages/{id}) and `MailboxSettings.ReadWrite` (for POST /outlook/masterCategories). Accepts credentials of type `oauth2` (access + refresh token), `service-account` (tenant id + client id + client secret), or `object` (advanced Graph config).",
"ui_widget": "connection_picker",
"ui_options": {
"credential_types": [
"oauth2",
"service-account",
"object"
],
"types": [
"outlook",
"microsoft365",
"oauth2"
]
}
},
"mailbox_mode": {
"type": "string",
"title": "Mailbox",
"enum": [
"token_owner",
"other"
],
"default": "token_owner",
"description": "Token owner: uses the mailbox of the account that generated the credential. Other mailbox: specify an email address (requires Application permissions in Azure AD)."
},
"mailbox_email": {
"title": "Mailbox Email(s)",
"description": "Single email or array/comma-separated list of mailboxes to operate on. When more than one is provided, the worker fans out and applies the categories in every mailbox that contains the same message (matched by internetMessageId).",
"format": "expression",
"displayOptions": {
"show": {
"mailbox_mode": [
"other"
]
}
}
},
"internet_message_id": {
"type": "string",
"title": "Internet Message ID",
"description": "RFC-5322 Internet Message ID of the email (e.g., <[email protected]>). Required for multi-mailbox mode: the worker uses it to find the local message id in each mailbox via $filter=internetMessageId eq. When omitted and a single mailbox is provided, the worker falls back to the legacy single-mailbox flow using `message_id` directly.",
"format": "expression",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"operation": {
"type": "string",
"title": "Operation",
"enum": [
"apply",
"ensure_master_category",
"apply_with_ensure"
],
"default": "apply_with_ensure",
"description": "apply: apply categories to an existing message (merge-safe). ensure_master_category: create categories in the user master list (idempotent). apply_with_ensure: ensure + apply in one call (recommended)."
},
"message_id": {
"type": "string",
"title": "Message ID",
"description": "Graph message ID of the email to categorize.",
"format": "expression",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"categories": {
"type": "array",
"title": "Categories",
"items": {
"type": [
"string",
"object"
]
},
"description": "Categories to apply or ensure. Accepts: an array of display-name strings, a comma-separated string, OR an array of { name, color } objects to set a distinct color per category (e.g. [{name:\"Recibido por IA - Sommatic\",color:\"preset8\"},{name:\"Asignado DAUITA\",color:\"preset4\"}]). When an item has no color, the node-level category_color is used.",
"format": "expression"
},
"category_color": {
"type": "string",
"title": "Category Color",
"enum": [
"preset0",
"preset1",
"preset2",
"preset3",
"preset4",
"preset5",
"preset6",
"preset7",
"preset8",
"preset9",
"preset10",
"preset11",
"preset12",
"preset13",
"preset14",
"preset15",
"preset16",
"preset17",
"preset18",
"preset19",
"preset20",
"preset21",
"preset22",
"preset23",
"preset24",
"none"
],
"description": "Outlook category color preset. Required for ensure_master_category and apply_with_ensure (ignored by apply). Common values: preset0 (Red), preset8 (Purple), preset23 (Dark Purple - closest to Sommatic AI corporate #2A213B). Use \"none\" for no color.",
"displayOptions": {
"show": {
"operation": [
"ensure_master_category",
"apply_with_ensure"
]
}
}
},
"match_scope": {
"type": "string",
"title": "Match Scope",
"enum": [
"conversation",
"message"
],
"default": "conversation",
"description": "conversation (default): an internet_message_id is probed and expanded to the WHOLE thread (labels original + replies/forwards). message: resolve ONLY the exact internet_message_id matches (the reply/forward copy) — never expand to the conversation. Use \"message\" to label/mark-read a specific IA-generated copy without touching the citizen original.",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"mark_read": {
"type": "boolean",
"title": "Mark as Read",
"default": false,
"description": "After labeling, PATCH { isRead:true } on every resolved message. Scope it to IA-generated copies only (via match_scope:\"message\" or by targeting the forward_recipient mailbox); never point a mark_read node at the citizen original, which must stay unread.",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"resolve_max_attempts": {
"type": "number",
"title": "Resolve Max Attempts",
"default": 1,
"description": "Bounded retry on the message-resolution query. Absorbs Graph indexing latency of a just-sent reply/forward copy (a \"success that resolved 0 messages\" does not re-fire the node retry). Use e.g. 6 for IA-copy nodes; leave 1 for legacy calls.",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"resolve_wait_ms": {
"type": "number",
"title": "Resolve Wait (ms)",
"default": 0,
"description": "Delay between resolution attempts in milliseconds (e.g. 1500). Only relevant when resolve_max_attempts > 1.",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"require_apply": {
"type": "boolean",
"title": "Require Apply",
"default": false,
"description": "When true, emit port:\"error\" if nothing was labeled after all retries (instead of a silent success). Lets the caller drive a fallback branch (e.g. a notice + human task).",
"displayOptions": {
"show": {
"operation": [
"apply",
"apply_with_ensure"
]
}
}
},
"execution": {
"type": "object",
"title": "Execution Settings",
"properties": {
"alwaysOutputData": {
"type": "boolean",
"title": "Always Output Data",
"description": "Always output data, even on error (if configured).",
"default": false
},
"retryOnFail": {
"type": "boolean",
"title": "Retry On Fail",
"description": "Retry the execution if it fails.",
"default": false
},
"maxTries": {
"type": "integer",
"title": "Max Retries",
"description": "Number of retries.",
"default": 3,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"waitBetweenTries": {
"type": "integer",
"title": "Wait Between Retries (ms)",
"default": 1000,
"displayOptions": {
"show": {
"retryOnFail": [
true
]
}
}
},
"continueOnFail": {
"type": "boolean",
"title": "Continue On Fail",
"description": "Do not crash workflow on error.",
"default": false
},
"timeout_ms": {
"type": "integer",
"title": "Timeout (ms)",
"description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
"default": 300000
}
}
}
},
"required": [
"connection_id",
"operation"
]
}{
"type": "object",
"properties": {
"connection_id": {
"type": "string"
},
"operation": {
"type": "string"
},
"message_id": {
"type": "string"
},
"internet_message_id": {
"type": "string"
},
"conversation_id": {
"type": "string"
},
"categories": {
"type": "array",
"items": {
"type": "string"
}
},
"category_color": {
"type": "string"
},
"match_scope": {
"type": "string",
"enum": [
"conversation",
"message"
]
},
"mark_read": {
"type": "boolean"
},
"resolve_max_attempts": {
"type": "number"
},
"resolve_wait_ms": {
"type": "number"
},
"require_apply": {
"type": "boolean"
}
},
"required": [
"connection_id",
"operation"
]
}{
"type": "object",
"properties": {
"result": {
"type": "object",
"properties": {
"operation": {
"type": "string"
},
"message_id": {
"type": "string"
},
"applied": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories newly added to the message."
},
"preserved": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories that were already on the message and were preserved."
},
"final_categories": {
"type": "array",
"items": {
"type": "string"
},
"description": "Final categories on the message after the operation."
},
"ensured": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories created in the master list."
},
"already_existed": {
"type": "array",
"items": {
"type": "string"
},
"description": "Categories that already existed in the master list."
},
"master_category_ensured": {
"type": "boolean"
},
"conversation_id_resolved": {
"type": "string",
"description": "Thread id used to resolve messages (multi-mailbox mode)."
},
"messages_per_mailbox": {
"type": "object",
"description": "Count of messages labeled per mailbox."
},
"messages_read_by_mailbox": {
"type": "object",
"description": "Count of messages marked read (isRead:true) per mailbox, when mark_read is set."
}
}
}
}
}[
{
"port_id": "out",
"label": "Success",
"description": "Category operation completed successfully.",
"is_default": true,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Operation failed (auth error, invalid message ID, API error).",
"is_default": false,
"supports_condition": true
}
]Execution
- Execution
async- Stateful
- No
- Retries (
retryOnFail) - No
- Credentials
- Resolved on the server from
connection_id; the secret never reaches the workflow. - Capabilities
emailmicrosoftoutlookoffice365graph-apicategorylabel- Tags
emailmicrosoftoutlookoffice365categorylabelconnector
Notes and limits
- Applying is merge-safe and idempotent: existing categories are preserved and a category already present returns
reason: "already_present"withskipped. - Without
MailboxSettings.ReadWrite,apply_with_ensurestill labels the message and returnsmaster_category_ensured: falsewith awarning; the category may show without color. - In multi mode, a 401/403 in a mailbox is counted in
permission_denied_in, not as an error. Conversation ids differ per mailbox, so when a thread lookup returns nothing the worker re-derives the local thread frominternet_message_id. - Multi mode writes one
[label-trace]summary line to the logs per run, plus one line per mailbox where the label did not land.
Reviewed against the orchestrator code · 31e874b · 2026-11-26