Outlook - Message Category
通过 Microsoft Graph API 为邮件应用 Outlook 类别(标签)。
为 Outlook 邮件添加类别(标签)且不移除已有类别,并可在邮箱的主类别列表中创建带颜色的类别。既可按邮件 ID 在单个邮箱中操作,也可按 Internet Message ID 或会话在多个邮箱间分发执行。
类别保存在用户的主类别列表中,可通过合并安全的 PATCH 应用到邮件上,保留人工或其他自动化已设置的类别。
操作:
- apply: 为现有邮件应用一个或多个类别。与已有类别合并(不覆盖)。
- ensure_master_category: 在用户主类别列表中创建一个或多个类别。幂等:类别已存在时返回成功。
- apply_with_ensure: 以上两者的组合。推荐用于需要自行初始化类别的工作流。
工作原理
- 解析节点配置,必须提供
connection_id,并获取 Graph 令牌(使用client_id、client_secret、tenant_id申请应用令牌,或使用保存的token/access_token)。所有请求都要求返回不可变 ID(Prefer: IdType="ImmutableId")。 - 将
categories规范化:支持逗号分隔字符串、名称数组或{ name, color }数组;未指定颜色的项使用category_color。 - 当只有一个邮箱(或
mailbox_mode为token_owner)且未设置internet_message_id和conversation_id时,进入单邮箱模式,直接操作message_id。 - 否则在
mailbox_email(数组或逗号分隔列表)上分发执行。设置internet_message_id且match_scope: conversation时,先在各邮箱中探测会话 ID;随后按邮箱并行解析本地邮件(会话中的邮件最多 50 封;match_scope: message时只取与该 Internet Message ID 完全匹配的副本,最多 10 封),并按resolve_max_attempts次数重试,间隔resolve_wait_ms。 ensure_master_category在主类别列表中创建每个类别;已存在的类别视为成功,颜色不一致时会修正。apply读取邮件现有类别,去重合并新类别后执行 PATCH,对 412(change key)、429(遵循Retry-After)和 404 最多重试patch_max_attempts次。apply_with_ensure两者都执行。- 启用
mark_read时,将解析出的邮件标记为已读(尽力而为)。所有邮箱都失败,或启用了require_apply但没有任何邮件被打上标签时选择error,否则选择out。
在工作流中
节点在工作流文件(draft_nodes[])中的写法,以及一次成功运行的 envelope。
{
"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": "support@example.com",
"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"
}配置
-
connection_idstring 必填 -
用于访问 Microsoft Graph API 的凭据。需要 `Mail.ReadWrite`(用于 PATCH /messages/{id})和 `MailboxSettings.ReadWrite`(用于 POST /outlook/masterCategories)。接受 `oauth2`(access + refresh token)、`service-account`(tenant id + client id + client secret)或 `object`(高级 Graph 配置)类型的凭据。
-
mailbox_modestring 可选 -
Token owner:使用生成该凭据的账户的邮箱。Other mailbox:指定一个邮箱地址(需要在 Azure AD 中授予 Application 权限)。
-
mailbox_emailany 可选 支持表达式 -
要操作的单个邮箱,或邮箱数组/逗号分隔列表。提供多个时,worker 会扇出执行,在每个包含同一邮件(按 internetMessageId 匹配)的邮箱中应用类别。
-
internet_message_idstring 可选 支持表达式 -
邮件的 RFC-5322 Internet Message ID(例如 <BL0PR16MB...@outlook.com>)。多邮箱模式下必填:worker 通过 $filter=internetMessageId eq 在每个邮箱中查找本地消息 ID。省略且只提供单个邮箱时,worker 回退到旧的单邮箱流程,直接使用 `message_id`。
-
operationstring 必填 -
apply:为现有邮件应用类别(合并安全)。ensure_master_category:在用户主类别列表中创建类别(幂等)。apply_with_ensure:一次调用完成 ensure + apply(推荐)。
-
message_idstring 可选 支持表达式 -
要分类的邮件的 Graph 消息 ID。
-
categoriesarray<string | object> 可选 支持表达式 -
要应用或确保存在的类别。可接受:显示名称字符串数组、逗号分隔字符串,或 { name, color } 对象数组,用于为每个类别设置不同颜色(例如 [{name:"Recibido por IA - Sommatic",color:"preset8"},{name:"Asignado DAUITA",color:"preset4"}])。某项未指定颜色时,使用节点级的 category_color。
-
category_colorstring 可选 -
Outlook 类别颜色预设。ensure_master_category 和 apply_with_ensure 必填(apply 会忽略)。常用值:preset0(Red)、preset8(Purple)、preset23(Dark Purple,最接近 Sommatic AI 企业色 #2A213B)。使用“none”表示无颜色。
-
match_scopestring 可选 -
conversation(默认):探测 internet_message_id 并扩展到整个会话线程(为原邮件及回复/转发都加标签)。message:只解析与 internet_message_id 完全匹配的邮件(回复/转发副本),绝不扩展到会话。若只想为某个 AI 生成的副本加标签或标记已读、而不触碰公民原始邮件,请使用“message”。
-
mark_readboolean 可选 -
加标签后,对每封已解析的邮件执行 PATCH { isRead:true }。只应作用于 AI 生成的副本(通过 match_scope:"message" 或指向 forward_recipient 邮箱);切勿将 mark_read 节点指向公民原始邮件,原始邮件必须保持未读。
-
resolve_max_attemptsnumber 可选 -
邮件解析查询的有限重试次数。用于吸收刚发送的回复/转发副本在 Graph 中的索引延迟(“成功但解析到 0 封邮件”不会再次触发节点重试)。AI 副本节点可用 6 之类的值;旧调用保持 1。
-
resolve_wait_msnumber 可选 -
两次解析尝试之间的延迟(毫秒,例如 1500)。仅在 resolve_max_attempts > 1 时有意义。
-
require_applyboolean 可选 -
为 true 时,若所有重试后仍未加上任何标签,则发出 port:"error"(而不是静默成功)。便于调用方走回退分支(例如发出通知并创建人工任务)。
配置中会显示通用执行设置,但该节点目前不执行重试(retryOnFail、maxTries)。所有节点均未实现 continueOnFail。
代码中的行为
除 schema 描述之外,实现代码对这些键的实际处理。
-
patch_max_attempts代码会读取,但未声明 - 未声明。每次类别 PATCH 的尝试次数(默认 4,最少 1)。重试间隔为
patch_wait_ms(未声明,默认 500)乘以尝试序号,Graph 返回Retry-After时以其为准。 -
conversation_id代码会读取,但未声明 - 未在配置 schema 中声明(仅出现在输入契约中)。设置后直接作为要打标签的会话,跳过按 Internet Message ID 的探测,并切换到多邮箱模式。
-
mailbox_email - 仅在
mailbox_mode为other时读取。可接受单个地址、数组或逗号分隔列表;超过一个地址即切换到多邮箱模式。 -
category_color - Outlook 预设颜色(
preset0…preset24)或none。apply会忽略此项。categories中每项的color优先。 -
mark_read - 单邮箱模式下将
message_id标记为已读;多邮箱模式下标记所有解析出的邮件。match_scope: conversation时会包含整个会话,如只需标记一份副本请使用match_scope: message。
输出端口
out 默认 单邮箱模式:类别已添加或原本就存在。多邮箱模式:至少一个邮箱未失败,此时输出为 { 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 校验失败(输出为信封 { ok, errors, port });单邮箱模式下 Graph 调用失败({ error, response });或多邮箱模式下所有邮箱都失败、或 require_apply 未发现任何已打标签的邮件(输出多邮箱 result)。
{
"ok": false,
"errors": [
"At least one category is required for apply operation"
],
"port": "error"
}在表达式中
后续节点可通过 $("Outlook - Message Category").item.json.<路径> 读取此节点输出中的内容(请把 Outlook - Message Category 换成你的节点标签)。Editor 标记工作流编辑器在 Previous Nodes 中提示的路径(输出契约);Worker 标记 worker 实际通过 out 返回的路径,依据“端口”一节所示的输出。
| 表达式 | 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.applied新添加到邮件上的类别。 | ||
$("Outlook - Message Category").item.json.result.preserved邮件上原有并被保留的类别。 | ||
$("Outlook - Message Category").item.json.result.final_categories操作完成后邮件上的最终类别。 | ||
$("Outlook - Message Category").item.json.result.ensured在主类别列表中创建的类别。 | ||
$("Outlook - Message Category").item.json.result.already_existed主类别列表中已存在的类别。 | ||
$("Outlook - Message Category").item.json.result.master_category_ensured | ||
$("Outlook - Message Category").item.json.result.conversation_id_resolved用于解析邮件的会话线程 ID(多邮箱模式)。 | — | |
$("Outlook - Message Category").item.json.result.messages_per_mailbox每个邮箱中被加标签的邮件数。 | — | |
$("Outlook - Message Category").item.json.result.messages_read_by_mailbox设置 mark_read 时,每个邮箱中被标记为已读(isRead:true)的邮件数。 | — | |
$("Outlook - Message Category").item.json.result.permission_denied | — |
— Editor: 编辑器会提示它,但 worker 并不返回:读取结果为 undefined。
— Worker: worker 会返回它,但编辑器不会提示:请手动输入。对象内部的键可能取决于你的数据或配置(例如每个标签一个键)。
错误
| 消息 | 端口 | 原因与处理 |
|---|---|---|
Microsoft 365 credential is required | error | connection_id 为空。 |
Failed to resolve Microsoft 365 access token | error | 凭据无法解析或令牌申请失败。 |
Message ID is required for apply operation | error | 单邮箱模式下未提供 message_id。 |
At least one category is required for apply operation | error | categories 为空。ensure_master_category 时的提示为 At least one category displayName is required。 |
Failed to ensure master category '<name>': <Graph message> | error | 创建类别失败,且原因不是“已存在”或权限错误。 |
Unknown operation: <operation> | error | operation 不是 apply、ensure_master_category 或 apply_with_ensure(单邮箱模式)。 |
No messages could be labeled in this mailbox: <reason> | error | 多邮箱模式:按邮箱记录在 errored_in 中(重试后仍存在的 change key 冲突记录在 conflict_in 中)。 |
输入契约
-
connection_idstring 必填 -
operationstring 必填 -
message_idstring 可选 -
internet_message_idstring 可选 -
conversation_idstring 可选 -
categoriesarray<string> 可选 -
category_colorstring 可选 -
match_scopestring 可选 -
mark_readboolean 可选 -
resolve_max_attemptsnumber 可选 -
resolve_wait_msnumber 可选 -
require_applyboolean 可选
输出契约
-
resultobject 可选 -
-
operationstring 可选 -
message_idstring 可选 -
appliedarray<string> 可选 -
新添加到邮件上的类别。
-
preservedarray<string> 可选 -
邮件上原有并被保留的类别。
-
final_categoriesarray<string> 可选 -
操作完成后邮件上的最终类别。
-
ensuredarray<string> 可选 -
在主类别列表中创建的类别。
-
already_existedarray<string> 可选 -
主类别列表中已存在的类别。
-
master_category_ensuredboolean 可选 -
conversation_id_resolvedstring 可选 -
用于解析邮件的会话线程 ID(多邮箱模式)。
-
messages_per_mailboxobject 可选 -
每个邮箱中被加标签的邮件数。
-
messages_read_by_mailboxobject 可选 -
设置 mark_read 时,每个邮箱中被标记为已读(isRead:true)的邮件数。
-
契约(JSON Schema)
与编排器声明完全一致的定义。All 是完整的 *.definition.js;可与上方各节对照,找出文档与 schema 之间的差异。发布前可用它校验节点。
{
"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., <BL0PR16MB...@outlook.com>). 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., <BL0PR16MB...@outlook.com>). 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
}
]执行
- 执行方式
async- 有状态
- 否
- 重试(
retryOnFail) - 否
- 凭据
- 在服务器端根据
connection_id解析,密钥不会进入工作流。 - 能力
emailmicrosoftoutlookoffice365graph-apicategorylabel- 标签
emailmicrosoftoutlookoffice365categorylabelconnector
说明与限制
- 添加类别是合并式且幂等的:已有类别会保留,若类别已存在则返回
reason: "already_present"和skipped。 - 缺少
MailboxSettings.ReadWrite权限时,apply_with_ensure仍会为邮件打标签,并返回master_category_ensured: false和warning;该类别可能显示为无颜色。 - 多邮箱模式下,某个邮箱返回 401/403 会计入
permission_denied_in,不视为错误。会话 ID 因邮箱而异,因此当按会话查找无结果时,worker 会根据internet_message_id重新推导本地会话。 - 多邮箱模式每次运行会在日志中写入一行
[label-trace]汇总,并为每个未成功打标签的邮箱各写一行。
已对照编排器代码核实 · 31e874b · 2026-11-26