integrate-whatsapp by gokapso/agent-skills
npx skills add https://github.com/gokapso/agent-skills --skill integrate-whatsapp首选路径:
kapso login)kapso status 确认项目访问权限备用路径:环境变量:
KAPSO_API_BASE_URL (仅主机地址,不带 /platform/v1)KAPSO_API_KEYMETA_GRAPH_VERSION (可选,默认 v24.0)认证请求头(直接 API 调用):
X-API-Key: <api_key>
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
安装依赖(一次性):
npm i
首选集成路径(CLI):
kapso setupkapso projects listkapso projects use <project-id>kapso customers listkapso customers new --name "<customer-name>" --external-id <external-id>kapso setup --customer <customer-id>kapso whatsapp numbers list --output jsonkapso whatsapp numbers resolve --phone-number "<display-number>" --output json备用集成流程(直接 API):
POST /platform/v1/customersPOST /platform/v1/customers/:id/setup_linksphone_number_id 发送消息和配置 Webhook检测连接:
whatsapp.phone_number.created(推荐)推荐的 Kapso 设置链接默认值:
{
"setup_link": {
"allowed_connection_types": ["dedicated"],
"provision_phone_number": true,
"phone_number_country_isos": ["US"]
}
}
注意:
kapso setup 和 kapso whatsapp numbers new 默认使用专用号码和自动配置。
将 phone_number_country_isos、phone_number_area_code、language 和重定向 URL 作为可选覆盖项。
平台 API 基础路径:/platform/v1
Meta 代理基础路径:/meta/whatsapp/v24.0(消息、模板、媒体)
使用 phone_number_id 作为主要的 WhatsApp 标识符
使用 Webhook 接收:
作用域规则:
phone_number_id 的 WhatsApp 消息 + 对话事件whatsapp.message.*, whatsapp.conversation.*) 仅限电话号码级别创建 Webhook:
node scripts/create.js --scope project --url <https://...> --events <csv>node scripts/create.js --phone-number-id <id> --url <https://...> --events <csv>创建/更新的常用标志:
--url <https://...> - Webhook 目标地址--events <csv|json-array> - 事件类型(Kapso Webhook)--kind <kapso|meta> - Kapso(基于事件)与原始 Meta 转发--payload-version <v1|v2> - 负载格式(推荐 v2)--buffer-enabled <true|false> - 为 whatsapp.message.received 启用缓冲--buffer-window-seconds <n> - 1-60 秒--max-buffer-size <n> - 1-100--active <true|false> - 启用/禁用测试发送:
node scripts/test.js --webhook-id <id>
始终验证签名。请参阅:
references/webhooks-overview.mdreferences/webhooks-reference.md不同操作需要两个 Meta ID:
| ID | 用于 | 如何发现 |
|---|---|---|
business_account_id (WABA) | 模板 CRUD | kapso whatsapp numbers resolve --phone-number "<display-number>" --output json 或 node scripts/list-platform-phone-numbers.mjs |
phone_number_id | 发送消息,媒体上传 | kapso whatsapp numbers resolve --phone-number "<display-number>" --output json 或 node scripts/list-platform-phone-numbers.mjs |
常用命令:
kapso whatsapp numbers list --output json
kapso whatsapp numbers resolve --phone-number "<display-number>" --output json
kapso whatsapp messages send --phone-number-id <PHONE_NUMBER_ID> --to <wa-id> --text "Hello from Kapso"
kapso whatsapp messages list --phone-number-id <PHONE_NUMBER_ID> --limit 50 --output json
kapso whatsapp messages get <MESSAGE_ID> --phone-number-id <PHONE_NUMBER_ID> --output json
kapso whatsapp conversations list --phone-number-id <PHONE_NUMBER_ID> --output json
kapso whatsapp templates list --phone-number-id <PHONE_NUMBER_ID> --output json
kapso whatsapp templates get <TEMPLATE_ID> --phone-number-id <PHONE_NUMBER_ID> --output json
安装:
npm install @kapso/whatsapp-cloud-api
创建客户端:
import { WhatsAppClient } from "@kapso/whatsapp-cloud-api";
const client = new WhatsAppClient({
baseUrl: "https://api.kapso.ai/meta/whatsapp",
kapsoApiKey: process.env.KAPSO_API_KEY!
});
通过 SDK:
await client.messages.sendText({
phoneNumberId: "<PHONE_NUMBER_ID>",
to: "+15551234567",
body: "Hello from Kapso"
});
node scripts/list-platform-phone-numbers.mjsassets/template-utility-order-status-update.json 起草模板负载node scripts/create-template.mjs --business-account-id <WABA_ID> --file <payload.json>node scripts/template-status.mjs --business-account-id <WABA_ID> --name <name>node scripts/send-template.mjs --phone-number-id <ID> --file <send-payload.json>交互式消息需要活跃的 24 小时会话窗口。对于窗口外的外发通知,请使用模板。
phone_number_idassets/send-interactive-*.json 中选择负载node scripts/send-interactive.mjs --phone-number-id <ID> --file <payload.json>首选路径:
kapso whatsapp messages ...、kapso whatsapp conversations ...、kapso whatsapp templates ...备用路径:
GET /{phone_number_id}/messages、GET /{phone_number_id}/conversationsclient.messages.query()、client.messages.get()、client.conversations.list()、client.conversations.get()、client.templates.get()创建:
parameter_format: "NAMED" 和 {{param_name}}(优于位置参数)language(而不是 language_code){{1}}发送时:
parameter_namesub_type: "url" 和 index 的 button 组件id 或 link(两者不能同时使用)使用 Flows 构建原生 WhatsApp 表单。在编辑 Flow JSON 之前,请阅读 references/whatsapp-flows-spec.md。
node scripts/create-flow.js --phone-number-id <id> --name <name>node scripts/update-flow-json.js --flow-id <id> --json-file <path>node scripts/publish-flow.js --flow-id <id>node scripts/send-test-flow.js --phone-number-id <id> --flow-id <id> --to <phone>node scripts/setup-encryption.js --flow-id <id>node scripts/set-data-endpoint.js --flow-id <id> --code-file <path>node scripts/deploy-data-endpoint.js --flow-id <id>node scripts/register-data-endpoint.js --flow-id <id>静态 Flows(无数据端点):
version: "7.3"routing_model 和 data_api_version 是可选的assets/sample-flow.json动态 Flows(带数据端点):
version: "7.3" 和 data_api_version: "3.0"routing_model 是必需的(定义有效的屏幕转换)assets/dynamic-flow.json处理函数签名:
async function handler(request, env) {
const body = await request.json();
// body.data_exchange.action: INIT | data_exchange | BACK
// body.data_exchange.screen: current screen id
// body.data_exchange.data: user inputs
return Response.json({
version: "3.0",
screen: "NEXT_SCREEN_ID",
data: { }
});
}
export 或 module.exportsscreen: "SUCCESS" 和 extension_message_response.paramsendpoint_uri 或 data_channel_uri(Kapso 会注入这些)"flow_token is missing":Flow 是动态的但没有数据端点。附加一个并刷新。| 脚本 | 用途 |
|---|---|
list.js | 列出 Webhook |
get.js | 获取 Webhook 详情 |
create.js | 创建 Webhook |
update.js | 更新 Webhook |
delete.js | 删除 Webhook |
test.js | 发送测试事件 |
| 脚本 | 用途 | 所需 ID |
|---|---|---|
list-platform-phone-numbers.mjs | 发现 business_account_id + phone_number_id | — |
list-connected-numbers.mjs | 列出 WABA 电话号码 | business_account_id |
list-templates.mjs | 列出模板(带过滤器) | business_account_id |
template-status.mjs | 检查单个模板状态 | business_account_id |
create-template.mjs | 创建模板 | business_account_id |
update-template.mjs | 更新现有模板 | business_account_id |
send-template.mjs | 发送模板消息 | phone_number_id |
send-interactive.mjs | 发送交互式消息 | phone_number_id |
upload-media.mjs | 为发送时头部上传媒体 | phone_number_id |
| 脚本 | 用途 |
|---|---|
list-flows.js | 列出所有 Flows |
create-flow.js | 创建新 Flow |
get-flow.js | 获取 Flow 详情 |
read-flow-json.js | 读取 Flow JSON |
update-flow-json.js | 更新 Flow JSON(创建新版本) |
publish-flow.js | 发布 Flow |
get-data-endpoint.js | 获取数据端点配置 |
set-data-endpoint.js | 创建/更新数据端点代码 |
deploy-data-endpoint.js | 部署数据端点 |
register-data-endpoint.js | 向 Meta 注册数据端点 |
get-encryption-status.js | 检查加密状态 |
setup-encryption.js | 设置 Flow 加密 |
send-test-flow.js | 发送测试 Flow 消息 |
delete-flow.js | 删除 Flow |
list-flow-responses.js | 列出存储的 Flow 响应 |
list-function-logs.js | 列出函数日志 |
list-function-invocations.js | 列出函数调用 |
| 脚本 | 用途 |
|---|---|
openapi-explore.mjs | 探索 OpenAPI(搜索/操作/模式/位置) |
示例:
node scripts/openapi-explore.mjs --spec whatsapp search "template"
node scripts/openapi-explore.mjs --spec whatsapp op sendMessage
node scripts/openapi-explore.mjs --spec whatsapp schema TemplateMessage
node scripts/openapi-explore.mjs --spec platform ops --tag "WhatsApp Flows"
node scripts/openapi-explore.mjs --spec platform op setupWhatsappFlowEncryption
node scripts/openapi-explore.mjs --spec platform search "setup link"
| 文件 | 描述 |
|---|---|
template-utility-order-status-update.json | 带有命名参数 + URL 按钮的 UTILITY 模板 |
send-template-order-status-update.json | order_status_update 的发送时负载 |
template-utility-named.json | 展示按钮排序规则的 UTILITY 模板 |
template-marketing-media-header.json | 带有 IMAGE 头部的 MARKETING 模板 |
template-authentication-otp.json | AUTHENTICATION OTP 模板 (COPY_CODE) |
send-interactive-buttons.json | 交互式按钮消息 |
send-interactive-list.json | 交互式列表消息 |
send-interactive-cta-url.json | 交互式 CTA URL 消息 |
send-interactive-location-request.json | 位置请求消息 |
send-interactive-catalog-message.json | 目录消息 |
sample-flow.json | 静态 Flow 示例(无端点) |
dynamic-flow.json | 动态 Flow 示例(带端点) |
webhooks-example.json | Webhook 创建/更新负载示例 |
automate-whatsapp - 工作流、代理和自动化
observe-whatsapp - 调试、日志、健康检查
[integrate-whatsapp file map]|root: . |.:{package.json,SKILL.md} |assets:{dynamic-flow.json,sample-flow.json,send-interactive-buttons.json,send-interactive-catalog-message.json,send-interactive-cta-url.json,send-interactive-list.json,send-interactive-location-request.json,send-template-order-status-update.json,template-authentication-otp.json,template-marketing-media-header.json,template-utility-named.json,template-utility-order-status-update.json,webhooks-example.json} |references:{detecting-whatsapp-connection.md,getting-started.md,platform-api-reference.md,setup-links.md,templates-reference.md,webhooks-event-types.md,webhooks-overview.md,webhooks-reference.md,whatsapp-api-reference.md,whatsapp-cloud-api-js.md,whatsapp-flows-spec.md} |scripts:{create-flow.js,create-function.js,create-template.mjs,create.js,delete-flow.js,delete.js,deploy-data-endpoint.js,deploy-function.js,get-data-endpoint.js,get-encryption-status.js,get-flow.js,get-function.js,get.js,list-connected-numbers.mjs,list-flow-responses.js,list-flows.js,list-function-invocations.js,list-function-logs.js,list-platform-phone-numbers.mjs,list-templates.mjs,list.js,openapi-explore.mjs,publish-flow.js,read-flow-json.js,register-data-endpoint.js,send-interactive.mjs,send-template.mjs,send-test-flow.js,set-data-endpoint.js,setup-encryption.js,submit-template.mjs,template-status.mjs,test.js,update-flow-json.js,update-function.js,update-template.mjs,update.js,upload-media.mjs,upload-template-header-handle.mjs} |scripts/lib:{args.mjs,cli.js,env.js,env.mjs,http.js,output.js,output.mjs,request.mjs,run.js,whatsapp-flow.js} |scripts/lib/webhooks:{args.js,kapso-api.js,webhook.js}
每周安装次数
660
代码仓库
GitHub 星标数
56
首次出现
Jan 29, 2026
安全审计
安装于
opencode587
gemini-cli579
codex575
github-copilot561
kimi-cli513
amp512
Preferred path:
kapso login)kapso status to confirm project access before onboarding or messagingFallback path: Env vars:
KAPSO_API_BASE_URL (host only, no /platform/v1)KAPSO_API_KEYMETA_GRAPH_VERSION (optional, default v24.0)Auth header (direct API calls):
X-API-Key: <api_key>
Install deps (once):
npm i
Preferred onboarding path (CLI):
kapso setupkapso projects listkapso projects use <project-id>kapso customers listkapso customers new --name "<customer-name>" --external-id <external-id>kapso setup --customer <customer-id>kapso whatsapp numbers list --output jsonkapso whatsapp numbers resolve --phone-number "<display-number>" --output jsonFallback onboarding flow (direct API):
POST /platform/v1/customersPOST /platform/v1/customers/:id/setup_linksphone_number_id to send messages and configure webhooksDetect connection:
whatsapp.phone_number.created (recommended)Recommended Kapso setup-link defaults:
{
"setup_link": {
"allowed_connection_types": ["dedicated"],
"provision_phone_number": true,
"phone_number_country_isos": ["US"]
}
}
Notes:
kapso setup and kapso whatsapp numbers new use dedicated plus provisioning by default.
Keep phone_number_country_isos, phone_number_area_code, language, and redirect URLs as optional overrides.
Platform API base: /platform/v1
Meta proxy base: /meta/whatsapp/v24.0 (messaging, templates, media)
Use phone_number_id as the primary WhatsApp identifier
Use webhooks to receive:
Scope rules:
phone_number_idwhatsapp.message.*, whatsapp.conversation.*) are phone-number onlyCreate a webhook:
node scripts/create.js --scope project --url <https://...> --events <csv>node scripts/create.js --phone-number-id <id> --url <https://...> --events <csv>Common flags for create/update:
--url <https://...> - webhook destination--events <csv|json-array> - event types (Kapso webhooks)--kind <kapso|meta> - Kapso (event-based) vs raw Meta forwarding--payload-version <v1|v2> - payload format (v2 recommended)--buffer-enabled <true|false> - enable buffering for whatsapp.message.received--buffer-window-seconds <n> - 1-60 seconds--max-buffer-size <n> - 1-100Test delivery:
node scripts/test.js --webhook-id <id>
Always verify signatures. See:
references/webhooks-overview.mdreferences/webhooks-reference.mdTwo Meta IDs are needed for different operations:
| ID | Used for | How to discover |
|---|---|---|
business_account_id (WABA) | Template CRUD | kapso whatsapp numbers resolve --phone-number "<display-number>" --output json or node scripts/list-platform-phone-numbers.mjs |
phone_number_id | Sending messages, media upload | kapso whatsapp numbers resolve --phone-number "<display-number>" --output json or node scripts/list-platform-phone-numbers.mjs |
Common commands:
kapso whatsapp numbers list --output json
kapso whatsapp numbers resolve --phone-number "<display-number>" --output json
kapso whatsapp messages send --phone-number-id <PHONE_NUMBER_ID> --to <wa-id> --text "Hello from Kapso"
kapso whatsapp messages list --phone-number-id <PHONE_NUMBER_ID> --limit 50 --output json
kapso whatsapp messages get <MESSAGE_ID> --phone-number-id <PHONE_NUMBER_ID> --output json
kapso whatsapp conversations list --phone-number-id <PHONE_NUMBER_ID> --output json
kapso whatsapp templates list --phone-number-id <PHONE_NUMBER_ID> --output json
kapso whatsapp templates get <TEMPLATE_ID> --phone-number-id <PHONE_NUMBER_ID> --output json
Install:
npm install @kapso/whatsapp-cloud-api
Create client:
import { WhatsAppClient } from "@kapso/whatsapp-cloud-api";
const client = new WhatsAppClient({
baseUrl: "https://api.kapso.ai/meta/whatsapp",
kapsoApiKey: process.env.KAPSO_API_KEY!
});
Via SDK:
await client.messages.sendText({
phoneNumberId: "<PHONE_NUMBER_ID>",
to: "+15551234567",
body: "Hello from Kapso"
});
node scripts/list-platform-phone-numbers.mjsassets/template-utility-order-status-update.jsonnode scripts/create-template.mjs --business-account-id <WABA_ID> --file <payload.json>node scripts/template-status.mjs --business-account-id <WABA_ID> --name <name>node scripts/send-template.mjs --phone-number-id <ID> --file <send-payload.json>Interactive messages require an active 24-hour session window. For outbound notifications outside the window, use templates.
phone_number_idassets/send-interactive-*.jsonnode scripts/send-interactive.mjs --phone-number-id <ID> --file <payload.json>Preferred path:
kapso whatsapp messages ..., kapso whatsapp conversations ..., kapso whatsapp templates ...Fallback path:
GET /{phone_number_id}/messages, GET /{phone_number_id}/conversationsclient.messages.query(), client.messages.get(), client.conversations.list(), client.conversations.get(), client.templates.get()Creation:
parameter_format: "NAMED" with {{param_name}} (preferred over positional)language (not language_code){{1}}Send-time:
parameter_name in header/body paramsbutton component with sub_type: "url" and indexid or link (never both)Use Flows to build native WhatsApp forms. Read references/whatsapp-flows-spec.md before editing Flow JSON.
node scripts/create-flow.js --phone-number-id <id> --name <name>node scripts/update-flow-json.js --flow-id <id> --json-file <path>node scripts/publish-flow.js --flow-id <id>node scripts/send-test-flow.js --phone-number-id <id> --flow-id <id> --to <phone>node scripts/setup-encryption.js --flow-id <id>node scripts/set-data-endpoint.js --flow-id <id> --code-file <path>node scripts/deploy-data-endpoint.js --flow-id <id>node scripts/register-data-endpoint.js --flow-id <id>Static flows (no data endpoint):
version: "7.3"routing_model and data_api_version are optionalassets/sample-flow.jsonDynamic flows (with data endpoint):
version: "7.3" with data_api_version: "3.0"routing_model is required (defines valid screen transitions)assets/dynamic-flow.jsonHandler signature:
async function handler(request, env) {
const body = await request.json();
// body.data_exchange.action: INIT | data_exchange | BACK
// body.data_exchange.screen: current screen id
// body.data_exchange.data: user inputs
return Response.json({
version: "3.0",
screen: "NEXT_SCREEN_ID",
data: { }
});
}
export or module.exportsscreen: "SUCCESS" with extension_message_response.paramsendpoint_uri or data_channel_uri (Kapso injects these)"flow_token is missing": flow is dynamic without a data endpoint. Attach one and refresh.| Script | Purpose |
|---|---|
list.js | List webhooks |
get.js | Get webhook details |
create.js | Create a webhook |
update.js | Update a webhook |
delete.js | Delete a webhook |
test.js | Send a test event |
| Script | Purpose | Required ID |
|---|---|---|
list-platform-phone-numbers.mjs | Discover business_account_id + phone_number_id | — |
list-connected-numbers.mjs | List WABA phone numbers | business_account_id |
list-templates.mjs | List templates (with filters) | business_account_id |
template-status.mjs | Check single template status | business_account_id |
create-template.mjs |
| Script | Purpose |
|---|---|
list-flows.js | List all flows |
create-flow.js | Create a new flow |
get-flow.js | Get flow details |
read-flow-json.js | Read flow JSON |
update-flow-json.js | Update flow JSON (creates new version) |
publish-flow.js | Publish a flow |
| Script | Purpose |
|---|---|
openapi-explore.mjs | Explore OpenAPI (search/op/schema/where) |
Examples:
node scripts/openapi-explore.mjs --spec whatsapp search "template"
node scripts/openapi-explore.mjs --spec whatsapp op sendMessage
node scripts/openapi-explore.mjs --spec whatsapp schema TemplateMessage
node scripts/openapi-explore.mjs --spec platform ops --tag "WhatsApp Flows"
node scripts/openapi-explore.mjs --spec platform op setupWhatsappFlowEncryption
node scripts/openapi-explore.mjs --spec platform search "setup link"
| File | Description |
|---|---|
template-utility-order-status-update.json | UTILITY template with named params + URL button |
send-template-order-status-update.json | Send-time payload for order_status_update |
template-utility-named.json | UTILITY template showing button ordering rules |
template-marketing-media-header.json | MARKETING template with IMAGE header |
template-authentication-otp.json | AUTHENTICATION OTP template (COPY_CODE) |
send-interactive-buttons.json |
automate-whatsapp - Workflows, agents, and automations
observe-whatsapp - Debugging, logs, health checks
[integrate-whatsapp file map]|root: . |.:{package.json,SKILL.md} |assets:{dynamic-flow.json,sample-flow.json,send-interactive-buttons.json,send-interactive-catalog-message.json,send-interactive-cta-url.json,send-interactive-list.json,send-interactive-location-request.json,send-template-order-status-update.json,template-authentication-otp.json,template-marketing-media-header.json,template-utility-named.json,template-utility-order-status-update.json,webhooks-example.json} |references:{detecting-whatsapp-connection.md,getting-started.md,platform-api-reference.md,setup-links.md,templates-reference.md,webhooks-event-types.md,webhooks-overview.md,webhooks-reference.md,whatsapp-api-reference.md,whatsapp-cloud-api-js.md,whatsapp-flows-spec.md} |scripts:{create-flow.js,create-function.js,create-template.mjs,create.js,delete-flow.js,delete.js,deploy-data-endpoint.js,deploy-function.js,get-data-endpoint.js,get-encryption-status.js,get-flow.js,get-function.js,get.js,list-connected-numbers.mjs,list-flow-responses.js,list-flows.js,list-function-invocations.js,list-function-logs.js,list-platform-phone-numbers.mjs,list-templates.mjs,list.js,openapi-explore.mjs,publish-flow.js,read-flow-json.js,register-data-endpoint.js,send-interactive.mjs,send-template.mjs,send-test-flow.js,set-data-endpoint.js,setup-encryption.js,submit-template.mjs,template-status.mjs,test.js,update-flow-json.js,update-function.js,update-template.mjs,update.js,upload-media.mjs,upload-template-header-handle.mjs} |scripts/lib:{args.mjs,cli.js,env.js,env.mjs,http.js,output.js,output.mjs,request.mjs,run.js,whatsapp-flow.js} |scripts/lib/webhooks:{args.js,kapso-api.js,webhook.js}
Weekly Installs
660
Repository
GitHub Stars
56
First Seen
Jan 29, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode587
gemini-cli579
codex575
github-copilot561
kimi-cli513
amp512
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
136,300 周安装
--active <true|false>| Create a template |
| business_account_id |
update-template.mjs | Update existing template | business_account_id |
send-template.mjs | Send template message | phone_number_id |
send-interactive.mjs | Send interactive message | phone_number_id |
upload-media.mjs | Upload media for send-time headers | phone_number_id |
get-data-endpoint.js | Get data endpoint config |
set-data-endpoint.js | Create/update data endpoint code |
deploy-data-endpoint.js | Deploy data endpoint |
register-data-endpoint.js | Register data endpoint with Meta |
get-encryption-status.js | Check encryption status |
setup-encryption.js | Set up flow encryption |
send-test-flow.js | Send a test flow message |
delete-flow.js | Delete a flow |
list-flow-responses.js | List stored flow responses |
list-function-logs.js | List function logs |
list-function-invocations.js | List function invocations |
| Interactive button message |
send-interactive-list.json | Interactive list message |
send-interactive-cta-url.json | Interactive CTA URL message |
send-interactive-location-request.json | Location request message |
send-interactive-catalog-message.json | Catalog message |
sample-flow.json | Static flow example (no endpoint) |
dynamic-flow.json | Dynamic flow example (with endpoint) |
webhooks-example.json | Webhook create/update payload example |