接受并处理KooMessage发送的上行消息接口
接口功能
接受并处理KooMessage发送的上行消息。
接口鉴权
通过KooMessage集成商接入WhatsApp使用该鉴权方式。
使用说明:
在AICC测,渠道配置页面,配置webhook密码。
调用whatsappadapter侧接口,请求中添加请求头Authorization,Authorization的值为webhook密码。
Headers请求参数
|
参数名称 |
选取原则 |
参数类型 |
默认值 |
说明 |
|---|---|---|---|---|
|
Content-Type |
必选 |
String |
无 |
固定填 application/json; charset=UTF-8。 |
|
Authorization |
必选 |
String |
无 |
AICC测渠道配置处配置的webhook认证密码 |
接口原型
|
请求方法 |
POST |
|
|---|---|---|
|
请求URL |
https://ip:port/social/on/whatsapp/koomessage/message/{channelId} |
其中,ip:port为对外暴露的nslb的ip和port,channelId为渠道id |
BODY请求参数
|
参数名称 |
选取原则 |
参数类型 |
说明 |
|---|---|---|---|
|
sender |
必选 |
String |
商户电话 |
|
user_number |
必选 |
String |
用户手机号 |
|
user_name |
必须 |
String |
用户名称 |
|
timestamp |
必须 |
String |
时间戳(秒级) |
|
message_id |
必须 |
String |
消息ID |
|
message_type |
必须 |
String |
支持接收的消息类型。 1. text 文本 2. image 图片 3. video 视频 4. audio 音频 5. document 文件 6. location 位置 7. interactive_button_reply 按钮互动消息 8. interactive_list_reply 列表互动消息 9. button 模板按钮 |
|
context |
必选 |
object |
引用消息;表4 context中参数说明 |
|
message |
必选 |
object |
入站消息;表 5message中参数说明 |
|
参数名称 |
选取原则 |
参数类型 |
说明 |
|---|---|---|---|
|
text |
可选 |
String |
文本消息内容。message_type为text时,此参数必选。 |
|
url |
可选 |
String |
媒体文件URL。message_type为image、audio、video、document时,此参数必选。 |
|
caption |
可选 |
String |
描述,message_type为image、audio、document时,此参数必选。 |
|
filename |
可选 |
String |
文件名称。message_type为document时,此参数必选。 |
|
payload |
可选 |
String |
负载。message_type为button时,此参数必选。 |
|
title |
可选 |
String |
交互式消息的返回内容。message_type为interactive_button_reply、interactive_list_reply时,此参数必选。 |
|
longitude |
可选 |
String |
经度,message_type为location 时,此参数必选。 |
|
latitude |
可选 |
String |
纬度,message_type为location 时,此参数必选。 |
|
name |
可选 |
String |
地址名称,message_type为location 时,此参数必选。 |
|
address |
可选 |
String |
详细地址,message_type为location 时,此参数必选。 |
响应参数
调用本接口无响应内容。
接口示例
- 请求示例
POST /social/on/whatsapp/koomessage/message/202105102694809992 host: 10.10.10.2:18446 connection: Keep-Alive x-forwarded-for: 10.10.10.3, 10.10.10.4 x-real-ip: 10.10.10.5 content-length: 401 remote-host: 10.10.10.6 user-agent: java/socket Authorization: ************* content-type: application/json; charset=utf-8 accept: */* { "sender" : "86173xxxx4526", "timestamp" : "1719318962", "message" : { "text" : "this is text message" }, "user_number" : "86187xxxx5632", "user_name" : "user_name", "message_id" : "110630e87b3a49b382cc30b5c9a508366", "message_type" : "text" }