API: rcs/template - 模板查詢API
概覽
rcs/template
用于查詢5G消息模板。
URL
https://api-v4.mysubmail.com/rcs/template
接口響應(yīng)數(shù)據(jù)格式
格式 | URL |
---|---|
json | https://api-v4.mysubmail.com/rcs/template.json (默認(rèn)) |
xml | https://api-v4.mysubmail.com/rcs/template.xml |
yaml | https://api-v4.mysubmail.com/rcs/template.yaml |
一、創(chuàng)建模板
請求方式 | content-type設(shè)置 |
---|---|
get | 無 |
請求參數(shù)
參數(shù) | 類型 | 必須/可選 | 默認(rèn) | 描述 |
---|---|---|---|---|
appid | string | 必須 | 無 | 在 SUBMAIL Chatbot中創(chuàng)建的5G消息應(yīng)用ID |
timestamp | int | 可選 | 無 | UNIX 時間戳,結(jié)果以秒為單位,使用加密鑒權(quán)方式,此參數(shù)必填 |
signType | enum | 可選 | normal | API 鑒權(quán)模式,可選參數(shù)normal 、sha256 |
signature | string | 必須 | 無 | 鑒權(quán)簽名 1. 當(dāng) signType 為sha256 時,將以下參數(shù)拼接appid +appkey +appid=12345&signType=sha256& timestamp=1712122221 +appid +appkey “+”號為鏈接符號,不參與拼接 用sha256將以上拼接字符串加密作為鑒權(quán)參數(shù) 當(dāng) signType 為normal 時,appkey 即是signature 的值 |
templateID | string | 可選 | 無 | 模板ID |
offset | int | 可選 | 0 | 偏移量 |
rows | int | 可選 | 50 | 數(shù)據(jù)行 |
請求示例
curl --location --request GET 'https://api-v4.mysubmail.com/rcs/template?appid=appid&signature=appkey&templateID=Xs4dvE'
成功返回
{
"status": "success",
"templates": [
{
"account": "508284d4749fcbf0750ee9c1b28302af",
"templateID": "uyiQbe",
"title": "單卡片消息",
"contentType": "application/vnd.gsma.botmessage.v1.0+json",
"message": "{\"message\":{\"generalPurposeCard\":{\"layout\":{\"cardWidth\":\"MEDIUM_WIDTH\",\"cardOrientation\":\"VERTICAL\",\"imageAlignment\":\"LEFT\"},\"content\":{\"media\":{\"mediaUrl\":\"https://ftnj01.xnq.r.10086.cn:10099/s/003032024040311atT7rLLdSyn050FD.png\",\"mediaContentType\":\"image/png\",\"mediaFileSize\":\"1259515\",\"height\":\"MEDIUM_HEIGHT\"},\"title\":\"這是卡片標(biāo)題\",\"description\":\"這是卡片正文\",\"suggestions\":[{\"action\":{\"displayText\":\"打開鏈接(內(nèi)置瀏覽器)\",\"postback\":{\"data\":\"open_url_internal\"},\"urlAction\":{\"openUrl\":{\"url\":\"https://rcs.10086.cn/\",\"application\":\"webview\"}}}},{\"action\":{\"displayText\":\"打開鏈接(默認(rèn)瀏覽器)\",\"postback\":{\"data\":\"open_url_browser\"},\"urlAction\":{\"openUrl\":{\"url\":\"https://rcs.10086.cn/\",\"application\":\"browser\"}}}},{\"action\":{\"displayText\":\"上報當(dāng)前位置\",\"postback\":{\"data\":\"set_by_chatbot_request_location_push\"},\"mapAction\":{\"requestLocationPush\":{}}}}]}}}}",
"suggestions": "{\"suggestions\":[{\"reply\":{\"displayText\":\"上行YES\",\"postback\":{\"data\":\"YES\"}}},{\"action\":{\"displayText\":\"打開鏈接(系統(tǒng)自帶瀏覽器)\",\"postback\":{\"data\":\"open_url_browser\"},\"urlAction\":{\"openUrl\":{\"url\":\"https://rcs.10086.cn/\",\"application\":\"browser\"}}}}]}",
"sms": "true",
"smsContent": "歡迎體驗5G消息回落,這是一條回落消息",
"mms": "false",
"mmsFilePath": "",
"mmsFileSize": 0,
"mmsFileExpired": "0001-01-01T00:00:00Z",
"createAt": "2024-04-03T14:14:56+08:00",
"updateAt": "2024-04-03T14:14:56+08:00",
"del": 0,
"checked": 1,
"api": 1,
"ipAddress": "124.78.57.249",
"rejectReason": ""
}
]
}
失敗返回
{
"status":"error",
"code":"2xxx",
"msg":"錯誤信息描述"
}