Check Consent
检查用户是否已同意某项活动。
占位用的同意检查:只校验 user_id 已设置,并始终以 consented: true 从 yes 输出。不会查询任何同意管理平台,也不会评估 purpose。
工作原理
- 解析配置:
user_id和purpose中的表达式基于当前运行求值。 - 当
user_id为空时,以user_id is required从error输出。 - 不查询任何同意记录:决策在代码中固定为已同意。
- 从
yes返回{ consented: true, timestamp },其中timestamp为求值时间(ISO 8601)。
在工作流中
节点在工作流文件(draft_nodes[])中的写法,以及一次成功运行的 envelope。
{
"node_id": "node-check-consent",
"label": "Check marketing consent",
"operator_slug": "consent.check",
"operator_version": "1.0.0",
"config": {
"user_id": "{{ $json.customer_id }}",
"purpose": "marketing_email"
}
}{
"ok": true,
"port": "yes",
"data": {
"consented": true,
"timestamp": "2026-11-26T15:04:05.000Z"
}
}配置
-
user_idstring 必填 -
purposestring 必填
代码中的行为
除 schema 描述之外,实现代码对这些键的实际处理。
-
purpose - Schema 要求填写,但运行时会忽略:任何用途得到的结果都相同。
输出端口
yes 默认 只要设置了 user_id,始终从此端口输出。
数据
{
"consented": true,
"timestamp": "2026-11-26T15:04:05.000Z"
}no 永远不会输出:worker 中没有拒绝同意的路径。
error user_id 为空。
数据
{
"error": "user_id is required"
}在表达式中
后续节点可通过 $("Check Consent").item.json.<路径> 读取此节点输出中的内容(请把 Check Consent 换成你的节点标签)。Editor 标记工作流编辑器在 Previous Nodes 中提示的路径(输出契约);Worker 标记 worker 实际通过 yes 返回的路径,依据“端口”一节所示的输出。
| 表达式 | Editor | Worker |
|---|---|---|
$("Check Consent").item.json.consented | ||
$("Check Consent").item.json.timestamp |
错误
| 消息 | 端口 | 原因与处理 |
|---|---|---|
user_id is required | error | user_id 为空,或其表达式解析为空值。请对照输入项检查表达式。 |
输入契约
-
user_idstring 必填 -
purposestring 必填
输出契约
-
consentedboolean 可选 -
timestampstring 可选
契约(JSON Schema)
与编排器声明完全一致的定义。All 是完整的 *.definition.js;可与上方各节对照,找出文档与 schema 之间的差异。发布前可用它校验节点。
{
"slug": "consent.check",
"name": "Check Consent",
"category": "identity",
"version": "1.0.0",
"description": "Checks if User has consented to activity.",
"capabilities": [
"privacy",
"consent"
],
"config_schema": {
"type": "object",
"properties": {
"user_id": {
"type": "string"
},
"purpose": {
"type": "string"
}
},
"required": [
"user_id",
"purpose"
]
},
"input_contract_schema": {
"type": "object",
"properties": {
"user_id": {
"type": "string"
},
"purpose": {
"type": "string"
}
},
"required": [
"user_id",
"purpose"
]
},
"output_contract_schema": {
"type": "object",
"properties": {
"consented": {
"type": "boolean"
},
"timestamp": {
"type": "string"
}
}
},
"ports": [
{
"port_id": "yes",
"label": "Consented",
"description": "User agreed",
"is_default": true,
"supports_condition": true
},
{
"port_id": "no",
"label": "Not Consented",
"description": "User did not agree",
"is_default": false,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Check failed",
"is_default": false,
"supports_condition": false
}
],
"execution_mode": "async",
"required_resources": [],
"compatible_worker_pools": [
"identity-worker"
],
"tags": [
"privacy",
"gdpr"
],
"is_stateful": false,
"publisher": {
"identity": "org_veripass",
"profile": {
"name": "Veripass",
"verified": true,
"url": "https://me.veripass.com/veripass",
"logo_url": null
}
}
}{
"type": "object",
"properties": {
"user_id": {
"type": "string"
},
"purpose": {
"type": "string"
}
},
"required": [
"user_id",
"purpose"
]
}{
"type": "object",
"properties": {
"user_id": {
"type": "string"
},
"purpose": {
"type": "string"
}
},
"required": [
"user_id",
"purpose"
]
}{
"type": "object",
"properties": {
"consented": {
"type": "boolean"
},
"timestamp": {
"type": "string"
}
}
}[
{
"port_id": "yes",
"label": "Consented",
"description": "User agreed",
"is_default": true,
"supports_condition": true
},
{
"port_id": "no",
"label": "Not Consented",
"description": "User did not agree",
"is_default": false,
"supports_condition": true
},
{
"port_id": "error",
"label": "Error",
"description": "Check failed",
"is_default": false,
"supports_condition": false
}
]执行
- 执行方式
async- 有状态
- 否
- 能力
privacyconsent- 标签
privacygdpr
说明与限制
- 不要依赖此节点执行同意管控:它从不走
no。在接入真实的同意数据源之前,请用显式调用(例如io.http)加flow.if来检查。 - 从
error端口输出不会使运行失败:引擎沿error上的连线继续;若没有连线,该分支直接结束。
已对照编排器代码核实 · 31e874b · 2026-11-26