作者:互联网 时间: 2026-08-08 15:10:02
WhatsApp Business 技能使开发人员和 AI 代理能够通过 Meta Cloud API 基础设施以编程方式与客户互动。通过利用 Openclaw Skills 的这一组件,您可以超越简单的文本,直接向用户的移动设备提供丰富且引人入胜的内容。
该技能专注于可靠性和多功能性,提供对文本、图像和复杂的交互式按钮的支持。它专为需要在保持专业形象的同时,在世界上最受欢迎的社交平台上扩展沟通规模的企业而设计。
下载入口:https://github.com/openclaw/skills/tree/main/skills/mrgoodb/whatsapp-business从源直接安装技能的最快方式。
npx clawhub@latest install whatsapp-business
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
<project>/skills/
优先级:工作区 > 本地 > 内置
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 whatsapp-business。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
要将其集成到您的 Openclaw Skills 工作流中,您必须首先从 Meta 开发者控制台获取凭据。在终端中设置以下环境变量:
export WHATSAPP_TOKEN="your_access_token_here"
export WHATSAPP_PHONE_ID="your_phone_number_id"
确保您的 WhatsApp Business 账户 (WABA) 已激活,且您的电话号码已在 Meta 商务管理平台中通过验证。
该技能利用 Meta Graph API 数据结构。数据组织为以下几种主要类型:
| 字段 | 描述 |
|---|---|
| to | 国际格式的接收者电话号码(例如:1234567890) |
| messaging_product | 常量值,设为 'whatsapp' |
| type | 定义负载格式(文本、模板、图像或交互式) |
| template | 包含用于企业发起聊天的模板名称和语言代码 |
| interactive | 定义 UI 元素,如按钮和回复 ID |
name: whatsapp-business
description: Send messages via WhatsApp Business Cloud API. Send templates, media, and interactive messages to customers.
metadata: {"clawdbot":{"emoji":"??","requires":{"env":["WHATSAPP_TOKEN","WHATSAPP_PHONE_ID"]}}}
Business messaging on WhatsApp.
export WHATSAPP_TOKEN="xxxxxxxxxx"
export WHATSAPP_PHONE_ID="xxxxxxxxxx"
curl -X POST "https://graph.facebook.com/v18.0/$WHATSAPP_PHONE_ID/messages" r
-H "Authorization: Bearer $WHATSAPP_TOKEN" r
-H "Content-Type: application/json" r
-d '{
"messaging_product": "whatsapp",
"to": "1234567890",
"type": "text",
"text": {"body": "Hello from WhatsApp Business!"}
}'
curl -X POST "https://graph.facebook.com/v18.0/$WHATSAPP_PHONE_ID/messages" r
-H "Authorization: Bearer $WHATSAPP_TOKEN" r
-H "Content-Type: application/json" r
-d '{
"messaging_product": "whatsapp",
"to": "1234567890",
"type": "template",
"template": {
"name": "hello_world",
"language": {"code": "en_US"}
}
}'
curl -X POST "https://graph.facebook.com/v18.0/$WHATSAPP_PHONE_ID/messages" r
-H "Authorization: Bearer $WHATSAPP_TOKEN" r
-H "Content-Type: application/json" r
-d '{
"messaging_product": "whatsapp",
"to": "1234567890",
"type": "image",
"image": {"link": "https://example.com/image.jpg"}
}'
curl -X POST "https://graph.facebook.com/v18.0/$WHATSAPP_PHONE_ID/messages" r
-H "Authorization: Bearer $WHATSAPP_TOKEN" r
-H "Content-Type: application/json" r
-d '{
"messaging_product": "whatsapp",
"to": "1234567890",
"type": "interactive",
"interactive": {
"type": "button",
"body": {"text": "Choose an option:"},
"action": {
"buttons": [
{"type": "reply", "reply": {"id": "yes", "title": "Yes"}},
{"type": "reply", "reply": {"id": "no", "title": "No"}}
]
}
}
}'
curl "https://graph.facebook.com/v18.0/{WABA_ID}/message_templates" r
-H "Authorization: Bearer $WHATSAPP_TOKEN"