Zalo API mt - nxtele/http-api-document GitHub Wiki
发送消息
通过API发起zalo号码消息发送服务
- URL:
https://api.nxcloud.com/v1/zalo/mt
- Method:
POST
- Content-Type:
application/json
- 需要鉴权:
是
鉴权机制
鉴权规则请参考地址:API接口调用约定
请求参数
header参数:
参数名 |
类型 |
必选 |
示例值 |
说明 |
accessKey |
String |
是 |
fme2na3kdi3ki |
用户身份标识 |
ts |
String |
是 |
1655710885431 |
当前请求的时间戳(单位是毫秒),牛信服务端允许用户端请求最大时间误差为60秒 |
bizType |
String |
是 |
9 |
Zalo业务类型,取固定值“9” |
action |
String |
是 |
mt |
Zalo业务操作,取固定值“mt” |
sign |
String |
是 |
6e9506557d1f289501d333ee2c365826 |
API入参参数签名,签名算法 |
body参数:
参数名 |
类型 |
必选 |
示例值 |
说明 |
appkey |
String |
是 |
pem28kje |
应用appkey |
phone |
String |
是 |
848xxxx1795 |
消息接收方的zalo号码,需要带国码。如848xxxx1795 |
functionType |
String |
是 |
template |
zalo消息功能类型,消息支持以下功能类型的发送: template |
messageData |
JsonObject |
是 |
参照请求示例 |
zalo消息体参数 |
drWebhook |
String |
否 |
https://xxxx/xxxx |
dr自定义推送地址(优先推送自定义地址),最大长度: 256字符 |
ext |
String |
否 |
|
透传字段,该字段为自定义信息,填写后在回执success,failed,delivered,journey_acknowledged中会原样返回,最大长度: 65535 字节 |
消息功能类型
- template:
参数名 |
类型 |
必选 |
示例值 |
说明 |
templateId |
String |
是 |
133214 |
模板ID |
journeyToken |
String |
否 |
xOZTk-513uRxumUxxxx..... |
发送journey 消息必填 |
templateData |
JsonObject |
是 |
参照请求示例 |
zalo模板变量参数 |
请求示例
template请求示例
body(application/json) 参数:
普通ZNS消息
{
"appkey": "cWF32dfsa",
"functionType": "template",
"phone": "843xxxx9945",
"messageData": {
"templateId":"3121234",
"templateData": {
"customer_name": "ZJC",
"registered_code": "012432",
"registered_date": "20/03/2020"
}
}
}
ZNS Journey 消息
{
"appkey": "cWF32dfsa",
"functionType": "template",
"phone": "843xxxx9945",
"messageData": {
"templateId":"3121777",
"journeyToken":"xOZTk-513uRxumUxxxx.....",
"templateData": {
"customer_name": "ZJC",
"registered_code": "012432",
"registered_date": "20/03/2020"
}
}
}
响应示例
成功示例
{
"code": 0,
"message": "Success",
"data": {
"requestId": "zalomid.a1270d57c4274fa9917e0ad2629e3a99"
},
"traceId": "d9be566c3fff464190fd1082b8b67d3a"
}
失败示例
{
"code": -1,
"message": "Failure",
"traceId": "77f8709b545f4fee93fd7f098be9df04"
}
响应码说明
code |
message |
解决办法 |
0 |
Success |
|
-1 |
Failure |
请联系技术人员排除问题 |
1000~100X |
Authentication failed |
详情查看API鉴权部分 |
1100 |
Customer does not exist / Status is unavailable |
账号状态异常,联系业务人员处理账号问题 |
1102 |
Insufficient balance |
账号余额不足,请联系业务人员充值 |
9000 |
Request parameter error |
参数缺失,请检查必须的参数 |
9001 |
System business error |
系统业务错误,请联系技术人员排除问题 |
9002 |
Phone number error |
非法号码,请检查号码正确性 |
9003 |
Customer APP does not exist / Status is unavailable |
应用状态异常,联系业务人员处理云平台应用创建/禁用问题 |
9004 |
Customer APP does not have quotation |
应用报价缺失,联系业务人员处理应用报价问题 |
9005 |
Missing customer APP routes |
应用路由缺失,请联系技术人员排查路由 |
17001 |
Zalo vendor template does not exist |
供应商模板不存在 |
17002 |
Zalo vendor template status is unavailable |
供应商模板状态不可用 |
9999 |
Unknown error |
请联系技术人员排除问题 |
附录
发送说明
- 消息发送只支持越南
- 所有消息都需要申请模板
- 可添加文本字符400
- 可添加参数0-8个
- 消息到达时间非OTP消息模板<=7200 sec,OTP模版<=15 sec,超过则不计费