API: rcs/batchxsend - 群發(fā)消息API
概覽
rcs/batchxsend 用于通過模板群發(fā)消息和點(diǎn)對(duì)點(diǎn)消息,模板正文、懸浮菜單支持變量。
URL
https://api-v4.mysubmail.com/rcs/batchxsend
接口響應(yīng)數(shù)據(jù)格式
| 格式 | URL |
|---|---|
json | https://api-v4.mysubmail.com/rcs/batchxsend.json(默認(rèn)) |
xml | https://api-v4.mysubmail.com/rcs/batchxsend.xml |
yaml | https://api-v4.mysubmail.com/rcs/batchxsend.yaml |
一、創(chuàng)建模板
| 請(qǐng)求方式 | content-type設(shè)置 |
|---|---|
post | multipart/form-data、x-www-form-urlencoded、application/json |
請(qǐng)求參數(shù)
| 參數(shù) | 類型 | 必須/可選 | 默認(rèn) | 描述 |
|---|---|---|---|---|
appid | string | 必須 | 無 | 在 SUBMAIL Chatbot中創(chuàng)建的5G消息應(yīng)用ID |
timestamp | int | 可選 | 無 | UNIX 時(shí)間戳,結(jié)果以秒為單位,使用加密鑒權(quán)方式,此參數(shù)必填 |
signType | enum | 可選 | normal | API 鑒權(quán)模式,可選參數(shù)normal、sha256 |
signature | string | 必須 | 無 | 鑒權(quán)簽名 1. 當(dāng) signType為sha256時(shí),將以下參數(shù)拼接appid+appkey+appid=12345&signType=sha256& timestamp=1712122221+appid+appkey“+”號(hào)為鏈接符號(hào),不參與拼接 用sha256將以上拼接字符串加密作為鑒權(quán)參數(shù) 當(dāng) signType為normal時(shí),appkey即是signature的值 |
tos | string | 必須 | 無 | 接收方手機(jī)號(hào),多個(gè)號(hào)碼用半角逗號(hào)分隔,一次最大提交100個(gè)號(hào)碼,示例:15288888888,15266666666,15299999999 |
conversationID | string | 必須 | 無 | 唯一標(biāo)識(shí)主被叫用戶間的一個(gè)聊天對(duì)話,建議使用UUID。終端點(diǎn)擊消息中的建議操作或建議回復(fù)按鈕,觸發(fā)上行消息攜帶的conversationID將填寫該下行消息的conversationID值 |
contributionId | string | 必須 | 無 | 唯一標(biāo)識(shí)一個(gè)聊天會(huì)話,建議使用UUID。終端點(diǎn)擊此消息中的建議操作或建議回復(fù)按鈕,觸發(fā)上行消息攜帶的inReplyToContributionID將填寫該下行消息的contributionID值。 |
trafficType | enum | 可選 | advertisement | 流量標(biāo)識(shí),可選值包括:advertisement payment premium subscription plugin |
shortMessageSupported | string | 可選 | false | 是否支持短信回落, true:轉(zhuǎn)短信,false:不轉(zhuǎn)短信 |
smsBodyText | string | 可選 | 無 | 當(dāng)sms參數(shù)為true時(shí),此參數(shù)必填,當(dāng)接收方手機(jī)不支持5G消息時(shí),消息會(huì)以短信的形式回落。當(dāng)sms參數(shù)為false時(shí),此參數(shù)無效注: 回落短信至終端時(shí)平臺(tái)會(huì)自動(dòng)在短信內(nèi)容的基礎(chǔ)上拼接中文括號(hào)+Chatbot簽名,總長度按UTF-8編碼字節(jié)數(shù)計(jì)算,示例: 短信內(nèi)容:回落短信 Chatbot簽名:機(jī)器人 最終回落內(nèi)容:【機(jī)器人】回落短信 最終回落內(nèi)容字節(jié)數(shù):27 如最終回落內(nèi)容字節(jié)數(shù)超過1340,回落至終端的文本會(huì)轉(zhuǎn)化為鏈接,以終端實(shí)際效果為準(zhǔn)。 |
multimediaMessageSupported | string | 可選 | false | 是否支持彩信回落,true:轉(zhuǎn)彩信,false:不轉(zhuǎn)彩信 |
mmsSubject | string | 可選 | 無 | 彩信標(biāo)題,最長60個(gè)字節(jié),支持彩信回落時(shí),該參數(shù)為必須參數(shù) |
mmsContentLength | int | 可選 | 無 | 彩信素材大小,支持彩信回落時(shí),該參數(shù)為必須參數(shù) |
mmsBodyText | string | 可選 | 無 | 彩信文件url,支持彩信回落時(shí),該參數(shù)為必須參數(shù) 注: 彩信文件URL需使用上傳素材文件后的鏈接 |
templateID | string | 必須 | 無 | 模板ID |
vars | json | 可選 | 無 | 變量內(nèi)容 |
sendlist | string | 可選 | 無 | 批量群發(fā)任務(wù)標(biāo)識(shí) |
請(qǐng)求示例
成功返回
{
"status": "success",
[{
"status":"success",
"to":"15288888888",
"send_id":"daa21ecf309149d04108004f6198f0d9",
"fee":1
},{
"status":"success",
"to":"15266666666",
"send_id":"4ee9be3058004b7f6a945558d580f4ce",
"fee":1
}]
}失敗返回
{
"status":"error",
"code":"2xxx",
"msg":"錯(cuò)誤信息描述"
}