EngageLab WhatsApp Business API Skill
This skill enables interaction with the EngageLab WhatsApp Business REST API. As a Meta-authorized WhatsApp Business solution provider, EngageLab connects businesses with over 2 billion WhatsApp users for marketing, notifications, OTP verification, and customer service.
It covers three areas:
- 1. Send Messages — Deliver template, text, image, video, audio, document, and sticker messages
- Template Management — Create, list, get, update, and delete WABA message templates
- Callbacks — Receive message delivery status, user responses, and system notifications
Resources
scripts/
- -
whatsapp_client.py — Python client class (EngageLabWhatsApp) wrapping all API endpoints: send_template(), send_text(), send_image(), send_video(), send_audio(), send_document(), send_sticker(), and template CRUD (list_templates(), get_template(), create_template(), update_template(), delete_template()). Handles authentication, request construction, and typed error handling.
references/
- -
error-codes.md — Complete error code tables for messaging and template APIs template-api.md — Full template CRUD specs with components object details (header, body, footer, buttons)callback-api.md — Webhook callback events: message status, message response, and system notifications
Authentication
All EngageLab WhatsApp API calls use HTTP Basic Authentication.
- - Base URL: INLINECODE17
- Header: INLINECODE18
- Content-Type: INLINECODE19
The user must provide their dev_key (DevKey) and dev_secret (DevSecret). Encode them as base64("dev_key:dev_secret") and set the Authorization header.
Example (using curl):
CODEBLOCK0
If the user hasn't provided credentials, ask them for their dev_key and dev_secret before generating API calls.
Quick Reference — All Endpoints
| Operation | Method | Path |
|---|
| Send message | INLINECODE26 | INLINECODE27 |
| List templates |
GET |
/v1/templates |
| Get template |
GET |
/v1/templates/:templateId |
| Create template |
POST |
/v1/templates |
| Update template |
PUT |
/v1/templates/:templateId |
| Delete template |
DELETE |
/v1/templates/:templateName |
Sending Messages
Endpoint: INLINECODE38
Request Body (Template Message)
CODEBLOCK1
Parameters
| Field | Type | Required | Description |
|---|
| INLINECODE39 | INLINECODE40 | No | Sending number with country code. Uses default sending number if omitted |
| INLINECODE41 |
string[] | Yes | Recipient WhatsApp phone numbers with country code |
|
body |
object | Yes | Message body — see message types below |
|
request_id |
string | No | Custom request ID, returned as-is in response and callbacks |
|
custom_args |
object | No | Custom data returned in message status callbacks |
Message Types
The body.type field determines the message type. Only template messages can be sent to users proactively. Other types require the user to have replied within the last 24 hours.
| Type | Description | 24h Window Required |
|---|
| INLINECODE50 | Pre-approved template message | No |
| INLINECODE51 |
Plain text (max 4096 chars) | Yes |
|
image | Image (JPEG/PNG, max 5MB) | Yes |
|
video | Video (MP4/3GPP, max 16MB) | Yes |
|
audio | Audio (AAC/MP4/AMR/MPEG/OGG, max 16MB) | Yes |
|
document | File (any MIME type, max 100MB) | Yes |
|
sticker | Sticker (WebP, static 100KB / animated 500KB) | Yes |
Text Message
CODEBLOCK2
Image Message
CODEBLOCK3
Video Message
CODEBLOCK4
Audio Message
CODEBLOCK5
Document Message
CODEBLOCK6
Sticker Message
CODEBLOCK7
Template Message Components
Template messages use pre-approved WABA templates with variable substitution via components:
CODEBLOCK8
Parameter types: text, currency, date_time, image, video, document. Media types only appear in header components.
Response
Success:
CODEBLOCK9
| Field | Type | Description |
|---|
| INLINECODE64 | INLINECODE65 | Unique EngageLab message ID |
| INLINECODE66 |
string | Your custom request ID (if provided) |
For error codes, read references/error-codes.md.
Template Management
WhatsApp message templates must be created and approved before use. Templates support HEADER, BODY, FOOTER, and BUTTONS components with variables.
For full request/response details including components object specs, read references/template-api.md.
Quick Summary
List all — GET /v1/templates with optional query params: name, language_code, category, INLINECODE74
Get one — INLINECODE75
Create — INLINECODE76
CODEBLOCK10
Update — PUT /v1/templates/:templateId (same body as create)
Delete — DELETE /v1/templates/:templateName (deletes all languages for that name)
Template Categories
| Category | Description |
|---|
| INLINECODE79 | Verification codes / OTP |
| INLINECODE80 |
Promotional content |
|
UTILITY | Service notifications |
Template Status Values
| Status | Description |
|---|
| INLINECODE82 | Available for sending |
| INLINECODE83 |
Awaiting review |
|
REJECTED | Review rejected |
|
DISABLED | Banned |
|
IN_APPEAL | Under appeal |
|
PAUSED | Temporarily paused |
Callbacks
Configure webhook URLs to receive message delivery status, user responses, and system notifications.
For full callback data structures and event types, read references/callback-api.md.
Message Status Events
| Status | Description |
|---|
| INLINECODE89 | Scheduled for sending |
| INLINECODE90 |
Number verified as valid |
|
target_invalid | Number is invalid |
|
sent | Successfully sent to Meta |
|
delivered | Delivered to user's device |
|
read | User has read the message |
|
sent_failed | Failed to send |
|
delivered_failed | Sent but delivery failed |
|
delivered_timeout | No delivery confirmation within 5 minutes |
User Response Events
| Event | Description |
|---|
| INLINECODE98 | User sent a direct message |
| INLINECODE99 |
User replied to your message |
|
order | User placed an order |
|
deleted | User deleted their message |
Generating Code
When the user asks to send WhatsApp messages or manage templates, generate working code. Default to curl unless the user specifies a language. Supported patterns:
- - curl — Shell commands with proper auth header
- Python — Using
requests library (or the bundled whatsapp_client.py) - Node.js — Using
fetch or INLINECODE106 - Java — Using INLINECODE107
- Go — Using INLINECODE108
Always include the authentication header and proper error handling. Use placeholder values like YOUR_DEV_KEY and YOUR_DEV_SECRET if the user hasn't provided credentials.
Media Format Requirements
| Type | Formats | Max Size |
|---|
| Image | JPEG, PNG (no transparent background) | 5 MB |
| Video |
MP4, 3GPP (H.264 video + AAC audio) | 16 MB |
| Audio | AAC, MP4, AMR, MPEG, OGG (opus codec) | 16 MB |
| Document | Any MIME type (PDF only for template headers) | 100 MB |
| Sticker | WebP | Static: 100 KB, Animated: 500 KB |
EngageLab WhatsApp Business API 技能
此技能支持与EngageLab WhatsApp Business REST API进行交互。作为Meta授权的WhatsApp Business解决方案提供商,EngageLab连接企业与超过20亿WhatsApp用户,用于营销、通知、OTP验证和客户服务。
涵盖三个领域:
- 1. 发送消息 — 发送模板、文本、图片、视频、音频、文档和贴纸消息
- 模板管理 — 创建、列出、获取、更新和删除WABA消息模板
- 回调 — 接收消息投递状态、用户响应和系统通知
资源
scripts/
- - whatsappclient.py — Python客户端类(EngageLabWhatsApp),封装所有API端点:sendtemplate()、sendtext()、sendimage()、sendvideo()、sendaudio()、senddocument()、sendsticker()以及模板CRUD操作(listtemplates()、gettemplate()、createtemplate()、updatetemplate()、delete_template())。处理身份验证、请求构建和类型化错误处理。
references/
- - error-codes.md — 消息和模板API的完整错误代码表
- template-api.md — 完整的模板CRUD规范,包含组件对象详情(头部、正文、页脚、按钮)
- callback-api.md — Webhook回调事件:消息状态、消息响应和系统通知
身份验证
所有EngageLab WhatsApp API调用均使用HTTP基本身份验证。
- - 基础URL:https://wa.api.engagelab.cc
- 请求头:Authorization: Basic key:devsecret)>
- Content-Type:application/json
用户必须提供其devkey(DevKey)和devsecret(DevSecret)。将它们编码为base64(devkey:devsecret)并设置Authorization请求头。
示例(使用curl):
bash
curl -X POST https://wa.api.engagelab.cc/v1/messages \
-H Content-Type: application/json \
-H Authorization: Basic $(echo -n YOURDEVKEY:YOURDEVSECRET | base64) \
-d { ... }
如果用户尚未提供凭据,请在生成API调用前询问其devkey和devsecret。
快速参考 — 所有端点
| 操作 | 方法 | 路径 |
|---|
| 发送消息 | POST | /v1/messages |
| 列出模板 |
GET | /v1/templates |
| 获取模板 | GET | /v1/templates/:templateId |
| 创建模板 | POST | /v1/templates |
| 更新模板 | PUT | /v1/templates/:templateId |
| 删除模板 | DELETE | /v1/templates/:templateName |
发送消息
端点:POST /v1/messages
请求体(模板消息)
json
{
from: +8613800138000,
to: [00447911123456],
body: {
type: template,
template: {
name: code,
language: en,
components: [
{
type: body,
parameters: [
{ type: text, text: 12345 }
]
}
]
}
},
request_id: my-request-123,
customargs: { orderid: ORD-456 }
}
参数
| 字段 | 类型 | 必填 | 描述 |
|---|
| from | string | 否 | 带国家代码的发送号码。省略时使用默认发送号码 |
| to |
string[] | 是 | 带国家代码的收件人WhatsApp电话号码 |
| body | object | 是 | 消息体 — 见下方消息类型 |
| request_id | string | 否 | 自定义请求ID,在响应和回调中原样返回 |
| custom_args | object | 否 | 在消息状态回调中返回的自定义数据 |
消息类型
body.type字段决定消息类型。只有模板消息可以主动发送给用户。 其他类型需要用户在过去24小时内回复过。
| 类型 | 描述 | 需要24小时窗口 |
|---|
| template | 预审批的模板消息 | 否 |
| text |
纯文本(最多4096字符) | 是 |
| image | 图片(JPEG/PNG,最大5MB) | 是 |
| video | 视频(MP4/3GPP,最大16MB) | 是 |
| audio | 音频(AAC/MP4/AMR/MPEG/OGG,最大16MB) | 是 |
| document | 文件(任意MIME类型,最大100MB) | 是 |
| sticker | 贴纸(WebP,静态100KB/动画500KB) | 是 |
文本消息
json
{
to: [8613800138000],
body: {
type: text,
text: { body: 您好,您的订单已发货! }
}
}
图片消息
json
{
to: [8613800138000],
body: {
type: image,
image: {
link: https://example.com/photo.jpg,
caption: 订单确认
}
}
}
视频消息
json
{
to: [8613800138000],
body: {
type: video,
video: {
link: https://example.com/demo.mp4,
caption: 产品演示
}
}
}
音频消息
json
{
to: [8613800138000],
body: {
type: audio,
audio: { link: https://example.com/voice.mp3 }
}
}
文档消息
json
{
to: [8613800138000],
body: {
type: document,
document: {
link: https://example.com/invoice.pdf,
caption: 您的发票,
filename: invoice_2024.pdf
}
}
}
贴纸消息
json
{
to: [8613800138000],
body: {
type: sticker,
sticker: { link: https://example.com/sticker.webp }
}
}
模板消息组件
模板消息使用预审批的WABA模板,通过components进行变量替换:
json
{
to: [00447911123456],
body: {
type: template,
template: {
name: order_update,
language: en,
components: [
{
type: header,
parameters: [
{ type: image, image: { link: https://example.com/product.jpg } }
]
},
{
type: body,
parameters: [
{ type: text, text: John },
{ type: text, text: ORD-12345 },
{ type: currency, currency: { fallbackvalue: $99.99, code: USD, amount1000: 99990 } }
]
}
]
}
}
}
参数类型:text、currency、date_time、image、video、document。媒体类型仅出现在头部组件中。
响应
成功:
json
{
message_id: cbggf4if6o9ukqaalfug,
request_id: my-request-123
}
| 字段 | 类型 | 描述 |
|---|
| messageid | string | 唯一的EngageLab消息ID |
| requestid |
string | 您的自定义请求ID(如果提供) |
关于错误代码,请阅读references/error-codes.md。
模板管理
WhatsApp消息模板必须先创建并审批通过才能使用。模板支持包含变量的HEADER、BODY、FOOTER和BUTTONS组件。
有关完整的请求/响应详情(包括组件对象规范),请阅读references/template-api.md。
快速摘要
列出所有 — GET /