消息回调服务
对提供的webhook地址,进行Meta业务相关的推送信息(目前支持推送消息回复和消息回执)
消息回复
终端用户回应客户下发消息,对终端用户回复消息内容进行推送(目前只支持用户对下发消息回复)
- URL:
message_webhook
- Method:
POST
- Content-Type:
application/json
回复参数
参数名 |
类型 |
说明 |
sender |
Object |
发送者信息 |
recipient |
Object |
接收者信息 |
sendTime |
Long |
消息发送时间戳(毫秒) |
appkey |
String |
应用标识 |
message |
Object |
消息内容 |
参数名 |
类型 |
说明 |
id |
String |
用户/页面ID |
参数名 |
类型 |
说明 |
text |
String |
文本消息内容(文本消息时存在) |
url |
String |
媒体文件URL(媒体消息时存在) |
type |
String |
媒体类型(image/audio/video) |
消息回复示例
文本消息
{
"sender": {
"id": "xxxid"
},
"recipient": {
"id": "xxxid"
},
"sendTime": 1736834239000,
"appkey": "xxkey",
"message": {
"text": "is a text"
}
}
图片
{
"sender": {
"id": "xxxid"
},
"recipient": {
"id": "xxxid"
},
"sendTime": 1736834621000,
"appkey": "xxkey",
"message": {
"url": "https://example.com/image",
"type": "image"
}
}
音频
{
"sender": {
"id": "xxxid"
},
"recipient": {
"id": "xxxid"
},
"sendTime": 1736834291000,
"appkey": "xxkey",
"message": {
"url": "https://example.com/audio",
"type": "audio"
}
}
视频
{
"sender": {
"id": "xxxid"
},
"recipient": {
"id": "xxxid"
},
"sendTime": 1736834506000,
"appkey": "xxkey",
"message": {
"url": "https://example.com/video",
"type": "video"
}
}
消息回执
消息发送状态的回执通知
- URL:
message_webhook
- Method:
POST
- Content-Type:
application/json
回执参数
参数名 |
类型 |
说明 |
status |
String |
消息状态(success: 成功) |
requestId |
String |
消息唯一标识 |
code |
Integer |
状态码(0: 成功) |
message |
String |
状态描述 |
sendTime |
String |
发送时间(格式:yyyy-MM-dd HH:mm:ss) |
消息回执示例
已送达
{
"status": "delivered",
"requestId": "metamid.xxx",
"code": 16001,
"message": "message has delivered",
"sendTime": "yyyy-MM-dd HH:mm:ss"
}
已读
{
"status": "read",
"requestId": "metamid.xxx",
"code": 16002,
"message": "message has seen",
"sendTime": "yyyy-MM-dd HH:mm:ss"
}
失败
{
"status": "failed",
"requestId": "metamid.xxx",
"code": 16000,
"message": "send error(api unavailable)",
"sendTime": "yyyy-MM-dd HH:mm:ss"
}