automate-whatsapp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAutomate WhatsApp
WhatsApp自动化
When to use
适用场景
Use this skill to build and run WhatsApp automations: workflow CRUD, graph edits, triggers, executions, function management, app integrations, and D1 database operations.
使用本技能构建并运行WhatsApp自动化:工作流增删改查(CRUD)、流程图编辑、触发器配置、执行管理、函数管理、应用集成以及D1数据库操作。
Setup
配置步骤
Env vars:
- (host only, no
KAPSO_API_BASE_URL)/platform/v1 KAPSO_API_KEY
环境变量:
- (仅需主机地址,无需
KAPSO_API_BASE_URL)/platform/v1 KAPSO_API_KEY
How to
操作指南
Edit a workflow graph
编辑工作流图
- Fetch graph: (note the
node scripts/get-graph.js <workflow_id>)lock_version - Edit the JSON (see graph rules below)
- Validate:
node scripts/validate-graph.js --definition-file <path> - Update:
node scripts/update-graph.js <workflow_id> --expected-lock-version <n> --definition-file <path> - Re-fetch to confirm
For small edits, use with and instead.
edit-graph.js--old-file--new-fileIf you get a lock_version conflict: re-fetch, re-apply changes, retry with new lock_version.
- 获取流程图:(注意记录
node scripts/get-graph.js <workflow_id>)lock_version - 编辑JSON文件(请遵循下方的流程图规则)
- 验证:
node scripts/validate-graph.js --definition-file <path> - 更新:
node scripts/update-graph.js <workflow_id> --expected-lock-version <n> --definition-file <path> - 重新获取以确认修改
若仅需小改动,可使用搭配和参数替代上述步骤。
edit-graph.js--old-file--new-file若遇到冲突:重新获取流程图,重新应用修改,使用新的重试。
lock_versionlock_versionManage triggers
管理触发器
- List:
node scripts/list-triggers.js <workflow_id> - Create:
node scripts/create-trigger.js <workflow_id> --trigger-type <type> --phone-number-id <id> - Toggle:
node scripts/update-trigger.js --trigger-id <id> --active true|false - Delete:
node scripts/delete-trigger.js --trigger-id <id>
For inbound_message triggers, first run to get .
node scripts/list-whatsapp-phone-numbers.jsphone_number_id- 列出触发器:
node scripts/list-triggers.js <workflow_id> - 创建触发器:
node scripts/create-trigger.js <workflow_id> --trigger-type <type> --phone-number-id <id> - 启用/禁用触发器:
node scripts/update-trigger.js --trigger-id <id> --active true|false - 删除触发器:
node scripts/delete-trigger.js --trigger-id <id>
配置触发器前,需先运行获取。
inbound_messagenode scripts/list-whatsapp-phone-numbers.jsphone_number_idDebug executions
调试执行流程
- List:
node scripts/list-executions.js <workflow_id> - Inspect:
node scripts/get-execution.js <execution-id> - Get value:
node scripts/get-context-value.js <execution-id> --variable-path vars.foo - Events:
node scripts/list-execution-events.js <execution-id>
- 列出执行记录:
node scripts/list-executions.js <workflow_id> - 查看执行详情:
node scripts/get-execution.js <execution-id> - 获取上下文变量值:
node scripts/get-context-value.js <execution-id> --variable-path vars.foo - 查看执行事件:
node scripts/list-execution-events.js <execution-id>
Create and deploy a function
创建并部署函数
- Write code with handler signature (see function rules below)
- Create:
node scripts/create-function.js --name <name> --code-file <path> - Deploy:
node scripts/deploy-function.js --function-id <id> - Verify:
node scripts/get-function.js --function-id <id>
- 编写符合处理函数签名的代码(请遵循下方的函数规则)
- 创建函数:
node scripts/create-function.js --name <name> --code-file <path> - 部署函数:
node scripts/deploy-function.js --function-id <id> - 验证部署:
node scripts/get-function.js --function-id <id>
Set up agent node with app integrations
配置带应用集成的Agent节点
- Find model:
node scripts/list-provider-models.js - Find account: (use
node scripts/list-accounts.js --app-slug <slug>)pipedream_account_id - Find action: (action_id = key)
node scripts/search-actions.js --query <word> --app-slug <slug> - Create integration:
node scripts/create-integration.js --action-id <id> --app-slug <slug> --account-id <id> --configured-props <json> - Add tools to agent node via
flow_agent_app_integration_tools
- 查找模型:
node scripts/list-provider-models.js - 查找账号:(使用
node scripts/list-accounts.js --app-slug <slug>)pipedream_account_id - 查找操作:(
node scripts/search-actions.js --query <word> --app-slug <slug>对应返回结果中的action_id)key - 创建集成:
node scripts/create-integration.js --action-id <id> --app-slug <slug> --account-id <id> --configured-props <json> - 通过为Agent节点添加工具
flow_agent_app_integration_tools
Database CRUD
数据库增删改查(CRUD)
- List tables:
node scripts/list-tables.js - Query:
node scripts/query-rows.js --table <name> --filters <json> - Create/update/delete with row scripts
- 列出数据表:
node scripts/list-tables.js - 查询数据:
node scripts/query-rows.js --table <name> --filters <json> - 使用行操作脚本完成数据的创建、更新与删除
Graph rules
流程图规则
- Exactly one start node with =
idstart - Never change existing node IDs
- Use for new node IDs
{node_type}_{timestamp_ms} - Non-decide nodes have 0 or 1 outgoing edge
next - Decide edge labels must match
conditions[].label - Edge keys are /
source/target(notlabel/from)to
For full schema details, see .
references/graph-contract.md- 必须有且仅有一个为
id的起始节点start - 切勿修改现有节点的ID
- 新节点ID使用格式
{node_type}_{timestamp_ms} - 非决策节点的输出边数量为0或1
next - 决策节点的边标签必须与匹配
conditions[].label - 边的键为/
source/target(而非label/from)to
完整的Schema详情,请查看。
references/graph-contract.mdFunction rules
函数规则
js
async function handler(request, env) {
// Parse input
const body = await request.json();
// Use env.KV and env.DB as needed
return new Response(JSON.stringify({ result: "ok" }));
}- Do NOT use ,
export, or arrow functionsexport default - Return a object
Response
js
async function handler(request, env) {
// Parse input
const body = await request.json();
// Use env.KV and env.DB as needed
return new Response(JSON.stringify({ result: "ok" }));
}- 请勿使用、
export或箭头函数export default - 必须返回对象
Response
Execution context
执行上下文
Always use this structure:
- - user-defined variables
vars - - system variables
system - - channel data
context - - request metadata
metadata
请始终遵循以下结构:
- - 用户定义变量
vars - - 系统变量
system - - 渠道数据
context - - 请求元数据
metadata
Scripts
脚本说明
Workflows
工作流相关
| Script | Purpose |
|---|---|
| List workflows (metadata only) |
| Get workflow metadata |
| Create a workflow |
| Update workflow settings |
| 脚本 | 用途 |
|---|---|
| 列出所有工作流(仅返回元数据) |
| 获取工作流元数据 |
| 创建工作流 |
| 更新工作流设置 |
Graph
流程图相关
| Script | Purpose |
|---|---|
| Get workflow graph + lock_version |
| Patch graph via string replacement |
| Replace entire graph |
| Validate graph structure locally |
| 脚本 | 用途 |
|---|---|
| 获取工作流流程图及 |
| 通过字符串替换方式修改流程图 |
| 替换整个工作流流程图 |
| 本地验证流程图结构合法性 |
Triggers
触发器相关
| Script | Purpose |
|---|---|
| List triggers for a workflow |
| Create a trigger |
| Enable/disable a trigger |
| Delete a trigger |
| List phone numbers for trigger setup |
| 脚本 | 用途 |
|---|---|
| 列出指定工作流的所有触发器 |
| 创建触发器 |
| 启用或禁用触发器 |
| 删除触发器 |
| 列出可用于触发器配置的WhatsApp手机号 |
Executions
执行管理相关
| Script | Purpose |
|---|---|
| List executions |
| Get execution details |
| Read value from execution context |
| Force execution state |
| Resume waiting execution |
| List execution events |
| 脚本 | 用途 |
|---|---|
| 列出执行记录 |
| 获取执行详情 |
| 读取执行上下文中的变量值 |
| 强制修改执行状态 |
| 恢复处于等待状态的执行流程 |
| 列出执行事件记录 |
Functions
函数相关
| Script | Purpose |
|---|---|
| List project functions |
| Get function details + code |
| Create a function |
| Update function code |
| Deploy function to runtime |
| Invoke function with payload |
| List function invocations |
| 脚本 | 用途 |
|---|---|
| 列出项目中的所有函数 |
| 获取函数详情及代码 |
| 创建函数 |
| 更新函数代码 |
| 将函数部署至运行时环境 |
| 传入负载调用函数 |
| 列出函数调用记录 |
App integrations
应用集成相关
| Script | Purpose |
|---|---|
| Search integration apps |
| Search actions (action_id = key) |
| Get action JSON schema |
| List connected accounts |
| Create OAuth connect link |
| Resolve remote_options for a prop |
| Reload dynamic props |
| List saved integrations |
| Create an integration |
| Update an integration |
| Delete an integration |
| 脚本 | 用途 |
|---|---|
| 搜索可集成的应用 |
| 搜索应用操作( |
| 获取操作的JSON Schema |
| 列出已连接的账号 |
| 创建OAuth连接链接 |
| 解析属性的远程选项 |
| 重新加载动态属性 |
| 列出已保存的集成配置 |
| 创建集成配置 |
| 更新集成配置 |
| 删除集成配置 |
Databases
数据库相关
| Script | Purpose |
|---|---|
| List D1 tables |
| Get table schema + sample rows |
| Query rows with filters |
| Create a row |
| Update rows |
| Upsert a row |
| Delete rows |
| 脚本 | 用途 |
|---|---|
| 列出D1数据表 |
| 获取数据表Schema及示例数据行 |
| 带过滤条件查询数据行 |
| 创建数据行 |
| 更新数据行 |
| 插入或更新数据行 |
| 删除数据行 |
OpenAPI
OpenAPI相关
| Script | Purpose |
|---|---|
| Explore OpenAPI (search/op/schema/where) |
Install deps (once):
bash
npm iExamples:
bash
node scripts/openapi-explore.mjs --spec workflows search "variables"
node scripts/openapi-explore.mjs --spec workflows op getWorkflowVariables
node scripts/openapi-explore.mjs --spec platform op queryDatabaseRows| 脚本 | 用途 |
|---|---|
| 探索OpenAPI(搜索、操作、Schema查询等) |
安装依赖(仅需执行一次):
bash
npm i示例:
bash
node scripts/openapi-explore.mjs --spec workflows search "variables"
node scripts/openapi-explore.mjs --spec workflows op getWorkflowVariables
node scripts/openapi-explore.mjs --spec platform op queryDatabaseRowsNotes
注意事项
- Prefer file paths over inline JSON (,
--definition-file)--code-file - is the same as
action_idfromkeysearch-actions - uses
--account-idfrompipedream_account_idlist-accounts - Variable CRUD (,
variables-set.js) is blocked - Platform API doesn't support itvariables-delete.js - Raw SQL execution is not supported via Platform API
- 优先使用文件路径而非内联JSON(如、
--definition-file参数)--code-file - 与
action_id返回结果中的search-actions一致key - 需使用
--account-id返回的list-accountspipedream_account_id - 变量增删改查(对应、
variables-set.js)功能被禁用——平台API暂不支持该操作variables-delete.js - 平台API不支持直接执行原生SQL
References
参考文档
Read before editing:
- references/graph-contract.md - Graph schema, computed vs editable fields, lock_version
- references/node-types.md - Node types and config shapes
- references/workflow-overview.md - Execution flow and states
Other references:
- references/execution-context.md - Context structure and variable substitution
- references/triggers.md - Trigger types and setup
- references/app-integrations.md - App integration and variable_definitions
- references/functions-reference.md - Function management
- references/functions-payloads.md - Payload shapes for functions
- references/databases-reference.md - Database operations
编辑前请阅读:
- references/graph-contract.md - 流程图Schema、计算字段与可编辑字段说明、lock_version机制
- references/node-types.md - 节点类型与配置格式
- references/workflow-overview.md - 执行流程与状态说明
其他参考文档:
- references/execution-context.md - 上下文结构与变量替换规则
- references/triggers.md - 触发器类型与配置步骤
- references/app-integrations.md - 应用集成与变量定义
- references/functions-reference.md - 函数管理指南
- references/functions-payloads.md - 函数负载格式说明
- references/databases-reference.md - 数据库操作指南
Assets
资源文件
| File | Description |
|---|---|
| Minimal linear workflow |
| Minimal branching workflow |
| Minimal agent workflow |
| Customer support intake |
| Interactive buttons + decide (function) |
| Interactive buttons + decide (AI) |
| API trigger + template + agent |
| Function for button routing |
| Agent node with app integrations |
| 文件 | 说明 |
|---|---|
| 极简线性工作流示例 |
| 极简分支工作流示例 |
| 极简Agent工作流示例 |
| 客户支持信息收集工作流 |
| 带交互按钮与函数决策的工作流 |
| 带交互按钮与AI决策的工作流 |
| API触发器+模板+Agent工作流 |
| 按钮路由处理函数 |
| 带应用集成的Agent节点示例 |
Related skills
相关技能
- - Onboarding, webhooks, messaging, templates, flows
integrate-whatsapp - - Debugging, logs, health checks
observe-whatsapp
text
[automate-whatsapp file map]|root: .
|.:{package.json,SKILL.md}
|assets:{agent-app-integration-example.json,databases-example.json,function-decide-route-interactive-buttons.json,functions-example.json,workflow-agent-simple.json,workflow-api-template-wait-agent.json,workflow-customer-support-intake-agent.json,workflow-decision.json,workflow-interactive-buttons-decide-ai.json,workflow-interactive-buttons-decide-function.json,workflow-linear.json}
|references:{app-integrations.md,databases-reference.md,execution-context.md,function-contracts.md,functions-payloads.md,functions-reference.md,graph-contract.md,node-types.md,triggers.md,workflow-overview.md,workflow-reference.md}
|scripts:{configure-prop.js,create-connect-token.js,create-function.js,create-integration.js,create-row.js,create-trigger.js,create-workflow.js,delete-integration.js,delete-row.js,delete-trigger.js,deploy-function.js,edit-graph.js,get-action-schema.js,get-context-value.js,get-execution-event.js,get-execution.js,get-function.js,get-graph.js,get-table.js,get-workflow.js,invoke-function.js,list-accounts.js,list-apps.js,list-execution-events.js,list-executions.js,list-function-invocations.js,list-functions.js,list-integrations.js,list-provider-models.js,list-tables.js,list-triggers.js,list-whatsapp-phone-numbers.js,list-workflows.js,openapi-explore.mjs,query-rows.js,reload-props.js,resume-execution.js,search-actions.js,update-execution-status.js,update-function.js,update-graph.js,update-integration.js,update-row.js,update-trigger.js,update-workflow-settings.js,upsert-row.js,validate-graph.js,variables-delete.js,variables-list.js,variables-set.js}
|scripts/lib/databases:{args.js,filters.js,kapso-api.js}
|scripts/lib/functions:{args.js,kapso-api.js}
|scripts/lib/workflows:{args.js,kapso-api.js,result.js}- - 初始化配置、Webhook、消息发送、模板管理、流程配置
integrate-whatsapp - - 调试、日志查看、健康检查
observe-whatsapp
text
[automate-whatsapp file map]|root: .
|.:{package.json,SKILL.md}
|assets:{agent-app-integration-example.json,databases-example.json,function-decide-route-interactive-buttons.json,functions-example.json,workflow-agent-simple.json,workflow-api-template-wait-agent.json,workflow-customer-support-intake-agent.json,workflow-decision.json,workflow-interactive-buttons-decide-ai.json,workflow-interactive-buttons-decide-function.json,workflow-linear.json}
|references:{app-integrations.md,databases-reference.md,execution-context.md,function-contracts.md,functions-payloads.md,functions-reference.md,graph-contract.md,node-types.md,triggers.md,workflow-overview.md,workflow-reference.md}
|scripts:{configure-prop.js,create-connect-token.js,create-function.js,create-integration.js,create-row.js,create-trigger.js,create-workflow.js,delete-integration.js,delete-row.js,delete-trigger.js,deploy-function.js,edit-graph.js,get-action-schema.js,get-context-value.js,get-execution-event.js,get-execution.js,get-function.js,get-graph.js,get-table.js,get-workflow.js,invoke-function.js,list-accounts.js,list-apps.js,list-execution-events.js,list-executions.js,list-function-invocations.js,list-functions.js,list-integrations.js,list-provider-models.js,list-tables.js,list-triggers.js,list-whatsapp-phone-numbers.js,list-workflows.js,openapi-explore.mjs,query-rows.js,reload-props.js,resume-execution.js,search-actions.js,update-execution-status.js,update-function.js,update-graph.js,update-integration.js,update-row.js,update-trigger.js,update-workflow-settings.js,upsert-row.js,validate-graph.js,variables-delete.js,variables-list.js,variables-set.js}
|scripts/lib/databases:{args.js,filters.js,kapso-api.js}
|scripts/lib/functions:{args.js,kapso-api.js}
|scripts/lib/workflows:{args.js,kapso-api.js,result.js}