Comment on page
发送whatsapp消息
推送消息给所有接收者
1、一个调用whatsapp接口的频率常态不能超过20 request per second,瞬时值不能超过60 request per second。落实到发消息的层面,发一条消息需要一个request,并且在给用户消息之前还需要有一个request来确认是否可以发push notification给这个用户。因此发消息给新用户的频率限制就是10 users per second。
2、每天可以发送push notification的用户数的限制:
限制分为三个tier,tier1:每天可以最多发notification到1000个用户。tier2:每天可以最多发notification到10000个用户。tier3:每天可以最多发notification到10万个用户。
升级方式:tier1->tier2:需满足在不超过7天内发送notification到2000个用户。 tier2->tier3:需满足在不超过7天内发送notification到20000个用户。
请求属性 | 属性名 | 说明 |
地址 | | |
请求方式 | POST | |
Header | APIKEY | 您的API KEY. |
Header | Content-Type | application/json |
Form Data | id | 由WhatsApp分配的消息ID |
Form Data | to | channel的手机号 |
Form Data | timestamp | 信息发送的时间戳 |
Form Data | source | 消息来源 (botchat/livechat ) |
Form Data | type | 消息类型(text/image/document/audio) |
Form Data | text | 当type=text 时显示。形式如下方Text message样例。 |
Form Data | image | 当type=image 时显示。形式如下方Image message样例。 |
Form Data | document | 当type=document 时显示。形式如下方Document message样例。 |
Form Data | audio | 当type=audio 时显示。形式如下方Audio message样例。 |
Text message
{
"id": "<unique message identifier>",
"to": "<phone number of the user>",
"timestamp": "<timestamp>",
"source": "<botchat / livechat>",
"type": "text",
"text": {
"body": "Hello world"
}
}
Image message
{
"id": "<unique message identifier>",
"to": "<phone number of the user>",
"timestamp": "<timestamp>",
"source": "<botchat / livechat>",
"type": "image",
"image": {
"url": "your-media-url",
"caption": "your-image-caption",
"extension": "<see the list of available extensions>"
}
}
Document message
{
"id": "<unique message identifier>",
"to": "<phone number of the user>",
"timestamp": "<timestamp>",
"source": "<botchat / livechat>",
"type": "document",
"document": {
"url": "your-document-url",
"caption": "your-document-caption",
"extension": "<see the list of available extensions>"
}
}
Audio message
{
"id": "<unique message identifier>",
"to": "<phone number of the user>",
"timestamp": "<timestamp>",
"source": "<botchat / livechat>",
"type": "document",
"audio": {
"url": "your-audio-url",
"caption": "your-audio-caption",
"extension": "<see the list of available extensions>"
}
}
- 成功返回值样例
{
"result": true,
"data": {}
}
- 失败返回值样例
{
"error": {
"code": 10011,
"error_subcode": 0,
"type": "",
"message": "Request already processed",
"request_id": 35122312158
}
}
返回值 | 内容 |
10000 | 内部错误 |
10001 | 未指定API KEY |
10002 | 无效的API KEY |
10003 | 未指定Request id |
10004 | 未指定调用API的种类 |
10005 | 无效的API种类 |
10005 | 无效的API种类 |
10006 | Bot不存在或者已经被删除 |
10011 | Request id与之前的重复 |
10100 | 参数无效 |
18000 | 内部错误 |
19000 | 回调超时 |
41006 | 未指定id |
41007 | 未指定to |
41008 | 未指定type |
41009 | 未指定timestamp |
41010 | 未指定image |
41011 | 未指定document |
41012 | 未指定text |
41013 | 未指定audio |
41014 | 无效的type |
41015 | 未指定text内的body |
41016 | 未指定document内的caption |
41017 | 未指定document内的url |
41018 | 未指定document内的extension |
41019 | 未指定image内的caption |
41021 | 未指定image内的url |
41022 | 未指定image内的extension |
41023 | 未指定audio内的caption |
41024 | 未指定audio内的url |
41025 | 未指定audio内的extension |
41035 | 未指定source |
41036 | source值不正确 |
80001 | BSP错误 |
80002 | network error |
Last modified 4yr ago