触发器 Beta
通过 Webhook 或其他工作流启动工作流,并管理 Ingress Binding。
通过链式调用触发工作流
POST /workflow-orchestration/trigger/chain/{mode}
从另一个工作流的链式节点分派一次工作流执行。按 slug 或定义 ID 解析目标工作流。模式决定执行测试版本(草稿)还是生产版本(已发布版本)。
认证: Bearer 令牌
参数
-
modestring 路径 必填 -
执行模式。“test”执行草稿,“prod”执行已发布版本。
testprod
请求体
链式调用载荷,包含目标工作流和输入数据。
-
organization_idstring 必填 -
目标工作流所属的组织范围。
-
target_flow_slugstring -
要调用的目标工作流的标识(slug)。
-
target_flow_definition_idstring -
明确指定的流程定义 ID,优先于 slug。
-
execution_modestring -
sync会等待执行完成;async立即返回。可选值syncasync -
dataobject -
传给目标工作流的输入数据。
-
chain_contextobject -
来自调用方工作流的追踪元数据。
-
caller_flow_instance_idstring -
caller_flow_slugstring -
caller_node_idstring -
correlation_idstring
-
响应
-
200工作流执行成功(同步模式)。 -
202工作流已分派(异步模式)。 -
404未找到目标工作流。 -
500服务器内部错误。
curl -X POST https://api.sommatic.ai/workflow-orchestration/trigger/chain/test \
-H "Authorization: Bearer $SOMMATIC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "<organization_id>"
}'const response = await fetch('https://api.sommatic.ai/workflow-orchestration/trigger/chain/test', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"organization_id": "<organization_id>"
}),
});
const { success, message, result } = await response.json();import os
import requests
response = requests.post(
"https://api.sommatic.ai/workflow-orchestration/trigger/chain/test",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
json={
"organization_id": "<organization_id>"
},
)
data = response.json(){
"status": 200,
"success": true,
"message": "Operation completed successfully",
"result": {}
}{
"status": 202,
"success": true,
"message": "Operation completed successfully",
"result": {}
}{
"status": 404,
"success": false,
"message": "Something was wrong while you make this action",
"result": {}
}{
"status": 500,
"success": false,
"message": "Something was wrong while you make this action",
"result": {}
}dispatchChainStream (/workflow-orchestration/trigger/chain/:mode/stream)
POST /workflow-orchestration/trigger/chain/{mode}/stream
认证: Bearer 令牌
参数
-
modestring 路径 必填
响应
curl -X POST https://api.sommatic.ai/workflow-orchestration/trigger/chain/<mode>/stream \
-H "Authorization: Bearer $SOMMATIC_TOKEN" \
-Nconst response = await fetch('https://api.sommatic.ai/workflow-orchestration/trigger/chain/<mode>/stream', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
},
});
const { success, message, result } = await response.json();import os
import requests
response = requests.post(
"https://api.sommatic.ai/workflow-orchestration/trigger/chain/<mode>/stream",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
)
data = response.json()通过 Webhook 触发工作流
POST /workflow-orchestration/trigger/webhooks/{mode}/{bindingIdentifier}
外部入口:任何能够发起 HTTP POST 的系统都可以通过它执行工作流。请求会按 id 或自定义 slug 解析为一个 IngressBinding,并将其目标 FlowDefinition 分派给编排器。
原始 HTTP 请求会作为工作流的初始 $input 传入,结构为 { body, headers, query, method }。下游节点可通过 {{ $json.body.<field> }} 读取 POST 的载荷,也可以引用上游节点:{{ $('Webhook Receiver').item.json.body.<field> }}。
默认情况下调用为同步,返回完整的编排器结果。对于长时间运行的工作流,可设置 execution_mode=async——响应会立即返回 instance_id,并可通过 /workflow-orchestration/execution/stream 的 SSE 通道跟踪进度。
该端点按设计不做身份验证。各绑定的鉴权(共享密钥、签名校验、IP 白名单)由 IngressBinding 的配置负责,而不是由此路由负责。
认证: 由 Ingress Binding 负责认证
参数
-
modestring 路径 必填 -
`test` 运行草稿;`prod` 运行最新的已发布版本。
testprod -
bindingIdentifierstring 路径 必填 -
`IngressBinding` 的 id(推荐)或其自定义 slug。
-
execution_modestring 查询 -
对于长时间运行的流程,可用 `async` 覆盖默认的 `sync` 行为。
syncasync
请求体
任意 JSON 载荷。完整 JSON 在工作流中为 `$json.body`。若请求体中存在以下两个便捷键,会被读取:`event`(路由提示)和 `execution_mode`(行为与同名查询参数相同)。
响应
-
202已接受。在 `sync` 模式下,响应包含编排器的最终结果;在 `async` 模式下,立即返回 `status: running` 和用于通过 SSE 流跟踪的 `instance_id`。 -
400路径或查询参数缺失或无效。 -
404未找到 `IngressBinding`,或其目标 `FlowDefinition` 无法解析为现有工作流。在 `prod` 模式下,若没有已发布的默认版本,也会返回此状态。 -
413请求体超过该路由的大小上限(5 MB)。 -
500编排器不可达,或分派过程中出现未处理的错误。
curl -X POST https://api.sommatic.ai/workflow-orchestration/trigger/webhooks/test/<bindingIdentifier> \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch('https://api.sommatic.ai/workflow-orchestration/trigger/webhooks/test/<bindingIdentifier>', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
const { success, message, result } = await response.json();import os
import requests
response = requests.post(
"https://api.sommatic.ai/workflow-orchestration/trigger/webhooks/test/<bindingIdentifier>",
json={},
)
data = response.json(){
"status": 202,
"success": true,
"message": "Operation completed successfully",
"result": {
"instance": {
"id": "wf-flow-instance-xxx",
"status": "completed"
},
"steps": [
{
"nodeId": "node-001",
"operatorSlug": "webhook.trigger",
"status": "success",
"port": "out",
"durationMs": 2
}
]
}
}{
"status": 202,
"success": true,
"message": "Operation completed successfully",
"result": {
"instance": {
"id": "wf-flow-instance-xxx",
"status": "running"
},
"execution_mode": "async"
}
}{
"status": 400,
"success": false,
"message": "Something was wrong while you make this action",
"result": {}
}{
"status": 404,
"success": false,
"message": "Something was wrong while you make this action",
"result": {}
}{
"status": 500,
"success": false,
"message": "Something was wrong while you make this action",
"result": {}
}创建入口绑定。
POST /workflow-orchestration/triggers/ingress-binding/
返回根据所提供数据创建的入口绑定。
认证: Bearer 令牌
请求体
要创建的 IngressBinding 对象。
-
organization_idstring 必填 -
该入口绑定所属组织的 ID。
-
slugstring 必填 -
唯一标识该入口绑定的稳定语义键(例如 ingress.http.email_inbound、ingress.queue.support_tickets)。
-
ingress_kindstring 必填 -
入口类型:"http"、"webhook"、"queue"、"event-grid"、"cron"、"pubsub"、"s3-event" 等。
-
descriptionstring -
可选,用于说明入口行为和用途的可读描述。
-
routestring -
该绑定的路径、主题、订阅或表达式。对于创建时未指定路由的 webhook 绑定,服务会设置为 "/trigger/webhooks/{test|prod}/{slug or id}";公开端点为 POST /workflow-orchestration/trigger/webhooks/{mode}/{bindingIdentifier}。示例:- "/trigger/webhooks/prod/ingress.http.inbound_email" - "queue:support_tickets" - "topic:user.events" - "cron:0 /5 * * * *"
-
target_trigger_idstring -
接收该入口绑定事件的 TriggerModel 的标识符。
-
target_flow_version_idstring -
可选,绕过 TriggerModel 时直接引用的 FlowVersionModel(高级模式)。
-
target_flow_definition_idstring -
可选,绑定到草稿流程的 webhook 触发器直接引用的 FlowDefinitionModel。
-
authenticationobject -
该入口端点的认证与授权要求。
-
modestring -
"none"、"api-key"、"oauth2"、"veripass-session"、"service-token"、"custom"。
-
allowed_api_keysarray<string> -
oauth_scopesarray<string> -
veripass_policystring -
可选,访问该入口端点所需的 Veripass 策略(角色、作用域、上下文规则)。
-
-
payload_mappingobject -
传入载荷的解码与校验规则,定义外部数据如何转换为内部 EnvelopeModel 载荷。
-
content_typestring -
"json"、"form-data"、"text"、"binary"、"base64" 或自定义解析器标识符。
-
json_pathstring -
可选,类似 JSONPath 的选择器,用于提取载荷中的子结构。
-
raw_bodyboolean -
为 true 时,在信封中保留原始 HTTP 请求体。
-
schemaobject -
可选,类似 JSON Schema 的结构,用于校验传入载荷。
-
-
correlation_strategystring -
为信封推导或生成 correlation_id 的策略:- "from-header" - "from-payload" - "auto-generate" - "custom-rule"
-
correlation_fieldstring -
当 correlation_strategy 引用请求头或载荷时使用的字段名(例如 "x-correlation-id")。
-
instance_creationobject -
定义收到事件时是否以及如何创建新的 FlowInstanceModel 执行的规则。
-
modestring -
"always-new"、"resume-existing"、"merge"、"conditional"、"none"。
-
resume_lookup_keystring -
在 "resume-existing" 模式下用于查找现有流程实例的字段(请求头或载荷)。
-
-
rate_limitobject -
可选的入口级限流,防止过度激活。
-
rpminteger -
rpsinteger
-
-
is_systemboolean -
为 true 表示该绑定由平台内部管理。
-
is_enabledboolean -
为 true 表示该入口绑定当前处于启用状态。
-
target_node_idstring -
该绑定所关联的流程图中的节点 ID,用于实现每个节点仅一对绑定的约束。
-
modestring -
该绑定的执行模式:"test"(通过 flow_definition_id 执行草稿)或 "production"(通过 flow_version_id 执行已发布版本)。
可选值testproduction -
is_deprecatedboolean -
为 true 表示新的集成不应再使用该绑定。
响应
-
200成功。 -
500执行此操作时出错。
curl -X POST https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/ \
-H "Authorization: Bearer $SOMMATIC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "<organization_id>",
"slug": "<slug>",
"ingress_kind": "<ingress_kind>"
}'const response = await fetch('https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"organization_id": "<organization_id>",
"slug": "<slug>",
"ingress_kind": "<ingress_kind>"
}),
});
const { success, message, result } = await response.json();import os
import requests
response = requests.post(
"https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
json={
"organization_id": "<organization_id>",
"slug": "<slug>",
"ingress_kind": "<ingress_kind>"
},
)
data = response.json(){
"status": 200,
"success": true,
"message": "Operation completed successfully",
"result": {
"organization_id": "org_1234567890",
"slug": "ingress.http.inbound_email",
"ingress_kind": "http",
"description": "HTTP webhook for receiving inbound email events from SendGrid.",
"route": "/trigger/webhooks/prod/ingress.http.inbound_email",
"target_trigger_id": "trig_email_webhook",
"target_flow_version_id": null,
"authentication": {
"mode": "api-key",
"allowed_api_keys": [
"sendgrid-prod-key-1"
]
},
"payload_mapping": {
"content_type": "json",
"json_path": "$.event",
"raw_body": false,
"schema": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"body": {
"type": "string"
}
}
}
},
"correlation_strategy": "from-header",
"correlation_field": "x-correlation-id",
"instance_creation": {
"mode": "always-new"
},
"rate_limit": {
"rps": 50
},
"is_system": false
}
}{
"status": 500,
"success": false,
"message": "Something was wrong while you make this action",
"result": null
}更新现有入口绑定。
PATCH /workflow-orchestration/triggers/ingress-binding/
使用所提供的数据更新现有入口绑定。
认证: Bearer 令牌
请求体
要创建的 IngressBinding 对象。
-
organization_idstring 必填 -
该入口绑定所属组织的 ID。
-
slugstring 必填 -
唯一标识该入口绑定的稳定语义键(例如 ingress.http.email_inbound、ingress.queue.support_tickets)。
-
ingress_kindstring 必填 -
入口类型:"http"、"webhook"、"queue"、"event-grid"、"cron"、"pubsub"、"s3-event" 等。
-
descriptionstring -
可选,用于说明入口行为和用途的可读描述。
-
routestring -
该绑定的路径、主题、订阅或表达式。对于创建时未指定路由的 webhook 绑定,服务会设置为 "/trigger/webhooks/{test|prod}/{slug or id}";公开端点为 POST /workflow-orchestration/trigger/webhooks/{mode}/{bindingIdentifier}。示例:- "/trigger/webhooks/prod/ingress.http.inbound_email" - "queue:support_tickets" - "topic:user.events" - "cron:0 /5 * * * *"
-
target_trigger_idstring -
接收该入口绑定事件的 TriggerModel 的标识符。
-
target_flow_version_idstring -
可选,绕过 TriggerModel 时直接引用的 FlowVersionModel(高级模式)。
-
target_flow_definition_idstring -
可选,绑定到草稿流程的 webhook 触发器直接引用的 FlowDefinitionModel。
-
authenticationobject -
该入口端点的认证与授权要求。
-
modestring -
"none"、"api-key"、"oauth2"、"veripass-session"、"service-token"、"custom"。
-
allowed_api_keysarray<string> -
oauth_scopesarray<string> -
veripass_policystring -
可选,访问该入口端点所需的 Veripass 策略(角色、作用域、上下文规则)。
-
-
payload_mappingobject -
传入载荷的解码与校验规则,定义外部数据如何转换为内部 EnvelopeModel 载荷。
-
content_typestring -
"json"、"form-data"、"text"、"binary"、"base64" 或自定义解析器标识符。
-
json_pathstring -
可选,类似 JSONPath 的选择器,用于提取载荷中的子结构。
-
raw_bodyboolean -
为 true 时,在信封中保留原始 HTTP 请求体。
-
schemaobject -
可选,类似 JSON Schema 的结构,用于校验传入载荷。
-
-
correlation_strategystring -
为信封推导或生成 correlation_id 的策略:- "from-header" - "from-payload" - "auto-generate" - "custom-rule"
-
correlation_fieldstring -
当 correlation_strategy 引用请求头或载荷时使用的字段名(例如 "x-correlation-id")。
-
instance_creationobject -
定义收到事件时是否以及如何创建新的 FlowInstanceModel 执行的规则。
-
modestring -
"always-new"、"resume-existing"、"merge"、"conditional"、"none"。
-
resume_lookup_keystring -
在 "resume-existing" 模式下用于查找现有流程实例的字段(请求头或载荷)。
-
-
rate_limitobject -
可选的入口级限流,防止过度激活。
-
rpminteger -
rpsinteger
-
-
is_systemboolean -
为 true 表示该绑定由平台内部管理。
-
is_enabledboolean -
为 true 表示该入口绑定当前处于启用状态。
-
target_node_idstring -
该绑定所关联的流程图中的节点 ID,用于实现每个节点仅一对绑定的约束。
-
modestring -
该绑定的执行模式:"test"(通过 flow_definition_id 执行草稿)或 "production"(通过 flow_version_id 执行已发布版本)。
可选值testproduction -
is_deprecatedboolean -
为 true 表示新的集成不应再使用该绑定。
响应
-
200成功。 -
500执行此操作时出错。
curl -X PATCH https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/ \
-H "Authorization: Bearer $SOMMATIC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "<organization_id>",
"slug": "<slug>",
"ingress_kind": "<ingress_kind>"
}'const response = await fetch('https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/', {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"organization_id": "<organization_id>",
"slug": "<slug>",
"ingress_kind": "<ingress_kind>"
}),
});
const { success, message, result } = await response.json();import os
import requests
response = requests.patch(
"https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
json={
"organization_id": "<organization_id>",
"slug": "<slug>",
"ingress_kind": "<ingress_kind>"
},
)
data = response.json(){
"status": 200,
"success": true,
"message": "Operation completed successfully",
"result": {
"organization_id": "org_1234567890",
"slug": "ingress.http.inbound_email",
"ingress_kind": "http",
"description": "HTTP webhook for receiving inbound email events from SendGrid.",
"route": "/trigger/webhooks/prod/ingress.http.inbound_email",
"target_trigger_id": "trig_email_webhook",
"target_flow_version_id": null,
"authentication": {
"mode": "api-key",
"allowed_api_keys": [
"sendgrid-prod-key-1"
]
},
"payload_mapping": {
"content_type": "json",
"json_path": "$.event",
"raw_body": false,
"schema": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"body": {
"type": "string"
}
}
}
},
"correlation_strategy": "from-header",
"correlation_field": "x-correlation-id",
"instance_creation": {
"mode": "always-new"
},
"rate_limit": {
"rps": 50
},
"is_system": false
}
}{
"status": 500,
"success": false,
"message": "Something was wrong while you make this action",
"result": null
}按 id 删除入口绑定。
DELETE /workflow-orchestration/triggers/ingress-binding/
根据所提供的 ID 删除入口绑定。
认证: Bearer 令牌
请求体
要删除的入口绑定 ID
-
idstring
响应
-
200成功。 -
500执行此操作时出错。
curl -X DELETE https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/ \
-H "Authorization: Bearer $SOMMATIC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "<id>"
}'const response = await fetch('https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/', {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"id": "<id>"
}),
});
const { success, message, result } = await response.json();import os
import requests
response = requests.delete(
"https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
json={
"id": "<id>"
},
)
data = response.json(){
"status": 200,
"success": true,
"message": "IngressBinding successfully deleted",
"result": null
}{
"status": 500,
"success": false,
"message": "Something went wrong while performing this action",
"result": null
}按查询选择器获取入口绑定。
GET /workflow-orchestration/triggers/ingress-binding/{queryselector}
返回与路由中指定的查询选择器和搜索条件匹配的入口绑定信息。
认证: Bearer 令牌
参数
-
queryselectorenum 路径 必填 -
此查询可用的筛选条件
idorganization-idall -
searchstring 查询 -
用于搜索实体的关键字。
-
include_statusstring 查询 -
可选的状态参数,用于包含指定状态的入口绑定。
-
exclude_statusstring 查询 -
可选的状态参数,用于排除指定状态的入口绑定。
-
pageinteger 查询 -
页码,从 1 开始(默认 1)。
-
pageSizeinteger 查询 -
每页记录数(默认 25)。
响应
-
200成功。 -
500执行此操作时出错。
curl -X GET https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/id \
-H "Authorization: Bearer $SOMMATIC_TOKEN"const response = await fetch('https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/id', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.SOMMATIC_TOKEN}`,
},
});
const { success, message, result } = await response.json();import os
import requests
response = requests.get(
"https://api.sommatic.ai/workflow-orchestration/triggers/ingress-binding/id",
headers={
"Authorization": f"Bearer {os.environ['SOMMATIC_TOKEN']}",
},
)
data = response.json(){
"status": 200,
"success": true,
"message": "Operation completed successfully",
"result": {
"organization_id": "org_1234567890",
"slug": "ingress.http.inbound_email",
"ingress_kind": "http",
"description": "HTTP webhook for receiving inbound email events from SendGrid.",
"route": "/trigger/webhooks/prod/ingress.http.inbound_email",
"target_trigger_id": "trig_email_webhook",
"target_flow_version_id": null,
"authentication": {
"mode": "api-key",
"allowed_api_keys": [
"sendgrid-prod-key-1"
]
},
"payload_mapping": {
"content_type": "json",
"json_path": "$.event",
"raw_body": false,
"schema": {
"type": "object",
"properties": {
"subject": {
"type": "string"
},
"body": {
"type": "string"
}
}
}
},
"correlation_strategy": "from-header",
"correlation_field": "x-correlation-id",
"instance_creation": {
"mode": "always-new"
},
"rate_limit": {
"rps": 50
},
"is_system": false
}
}{
"status": 500,
"success": false,
"message": "Something was wrong while you make this action",
"result": null
}