5G消息模板编辑
1、概述
5G消息模板编辑接口
2、接口地址
POST https://rcsapi.hanwg.com/rcs/template/editTemplate/{{chatbotId}}
3、请求参数
3.1、请求路径参数
见全局参数
3.2、请求头参数
3.3、请求体参数
模板中的素材必须审核通过才能成功上传模板
| 名称 | 数据类型 | 是否必有 | 描述 |
|---|---|---|---|
| templateId | string | 是 | 模板Id |
| templateName | string | 否 | 模板名称 文字个数[1, 17] |
| label | string | 否 | 模板标签 多个以“,”分隔 |
| draft | int | 否 | 是否为草稿 默认为1 |
| fallbackType | int | 否 | 模板回落类型的码号(默认为0) 见回落类型枚举 |
| fallbackContent | string | 条件 | 回落的内容 当:fallbackType= 注意:请勿在该字段中添加签名,因为系统将会自动添加Chatbot签名。计费时,总字符数将包括自动添加的签名字符及该字段的字符数,请务必注意计费细节。 |
| message | object | 是 | 消息内容对象 有5种类型:文本,文件,单卡片,多卡片,地理位置信息 |
4、请求示例
4.1、文本模板

文本+悬浮菜单(上行回复)
POST http://127.0.0.1:8002/rcs/template/editTemplate/a92e43085a0049ba8928b61fa04eeee
Authorization: ZGgxODUyODpiMDhjYWEzMDliYmIyZjYzZGNmMmZlZWYxMWU5ZDcxZg==
Date: 2023-05-23 15:06:57
Content-Type: application/json
User-Agent: Apifox/1.0.0 (https://www.apifox.cn)
Accept: */*
Host: 127.0.0.1:8002
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 580
{
"fallbackType": 0,
"message": {
"contentType": "text/plain",
"contentText": "回复Y确认订阅",
"contentEncoding": "utf8",
"suggestion": [
{
"reply": {
"displayText": "Y",
"postback": {
"data": "回执操作"
}
}
}
]
},
"templateId": "f80eae8532f44250be6bbd9e7998792a",
"templateName": "文本模板+不回落(菜单:上行回复)2",
"draft": 0
}
4.2、文件模板+短信回落

文件+悬浮菜单(上行回复+拨打电话+打开链接)
POST http://127.0.0.1:8002/rcs/template/editTemplate/a92e43085a0049ba8928b61fa04eeee
Authorization: ZGgxODUyODphOTY0NTgyMzAxN2EzODZlNTBmYTZmNzJlZmNkZjM4MA==
Date: 2023-05-23 15:33:12
Content-Type: application/json
User-Agent: Apifox/1.0.0 (https://www.apifox.cn)
Accept: */*
Host: 127.0.0.1:8002
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 1605
{
"fallbackType": 1,
"fallbackContent": "给您发了一条5G消息",
"message": {
"contentType": "application/vnd.gsma.rcs-ft-http",
"contentText": {
"fileId": "9e3f0bb74ea24100a1aad260aa65db31"
},
"suggestion": [
{
"reply": {
"displayText": "Y",
"postback": {
"data": "回执操作"
}
}
},
{
"action": {
"displayText": "普通拨号",
"postback": {
"data": "回执操作"
},
"dialerAction": {
"dialPhoneNumber": {
"phoneNumber": "15766666666"
}
}
}
},
{
"action": {
"displayText": "打开链接",
"postback": {
"data": "回执操作"
},
"urlAction": {
"openUrl": {
"url": "https://www.baidu.com",
"application": "browser"
}
}
}
}
]
},
"templateId": "be1e36d0dcf7408486e9f2aa3ca4514a",
"templateName": "文件模板+短信回落(悬浮菜单:上行回复+拨打电话+打开链接)",
"draft": 0
}
4.3、单卡片模板+智能消息回落
单卡片+建议菜单(撰写消息)+悬浮菜单(打开链接+地理位置)+智能消息回落
POST http://127.0.0.1:8002/rcs/template/editTemplate/a92e43085a0049ba8928b61fa04eeee
Authorization: ZGgxODUyODphZjU2ODRjMTA5YjY0ZDRiMGY1MTEzZDlhYjllOWIzOQ==
Date: 2023-05-23 15:13:59
Content-Type: application/json
User-Agent: Apifox/1.0.0 (https://www.apifox.cn)
Accept: */*
Host: 127.0.0.1:8002
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 2986
{
"fallbackType": 4,
"fallbackContent": "975e96f1cad84f739e855e9027754ae4",
"message": {
"contentType": "application/vnd.gsma.botmessage.v1.0+json",
"contentEncoding": "utf8",
"contentText": {
"generalPurposeCard": {
"layout": {
"cardOrientation": "VERTICAL",
"titleFontStyle": [
"bold"
],
"descriptionFontStyle": [
"italics"
]
},
"content": {
"media": {
"mediaId": "1038b2ec9cc941a98e5f8c4d691457f6",
"height": "TALL_HEIGHT"
},
"title": "卡片的标题",
"description": "卡片描述",
"suggestions": [
{
"action": {
"displayText": "短信草稿",
"postback": {
"data": "回执操作"
},
"composeAction": {
"composeTextMessage": {
"phoneNumber": "15766666666",
"text": "消息内容"
}
}
}
}
]
}
}
},
"suggestion": [
{
"action": {
"displayText": "打开链接",
"postback": {
"data": "回执操作"
},
"urlAction": {
"openUrl": {
"url": "https://www.baidu.com",
"application": "browser"
}
}
}
},
{
"action": {
"displayText": "地理位置/展示位置",
"postback": {
"data": "回执操作"
},
"mapAction": {
"showLocation": {
"location": {
"longitude": "116.403978",
"latitude": "39.915031",
"label": "标签"
}
}
}
}
}
]
},
"templateId": "0c51ff3132eb460694e917b38a234c0a",
"templateName": "单卡片+智能消息回落(建议菜单:撰写消息,悬浮菜单:打开链接+地理位置)",
"draft": 0
}4.4、多卡片模板+ch5回落

多卡片+建议菜单(撰写消息+设置日历)+悬浮菜单(打开链接)+ch5回落
POST http://127.0.0.1:8002/rcs/template/editTemplate/a92e43085a0049ba8928b61fa04eeee
Authorization: ZGgxODUyODo2MzRiZGEzZmZjZGZjZjY1NWQxOWYyYmNjNDQyMDE2Mg==
Date: 2023-05-23 15:16:59
Content-Type: application/json
User-Agent: Apifox/1.0.0 (https://www.apifox.cn)
Accept: */*
Host: 127.0.0.1:8002
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 3763
{
"fallbackType": 3,
"fallbackContent": "给您发了一条5G消息,请点击链接访问:${dh_rcs_h5_url}",
"message": {
"contentType": "application/vnd.gsma.botmessage.v1.0+json",
"contentEncoding": "utf8",
"contentText": {
"generalPurposeCardCarousel": {
"layout": {
"cardWidth": "MEDIUM_WIDTH",
"titleFontStyle": [
"bold"
],
"descriptionFontStyle": [
"italics"
]
},
"content": [
{
"media": {
"mediaId": "material_001",
"height": "TALL_HEIGHT"
},
"title": "卡片1标题",
"description": "卡片1描述",
"suggestions": [
{
"action": {
"displayText": "短信草稿",
"postback": {
"data": "回执操作"
},
"composeAction": {
"composeTextMessage": {
"phoneNumber": "15766666666",
"text": "消息内容"
}
}
}
}
]
},
{
"media": {
"mediaId": "material_002",
"height": "SHORT_HEIGHT"
},
"title": "卡片2标题",
"description": "卡片2描述",
"suggestions": [
{
"action": {
"displayText": "设置日历",
"postback": {
"data": "回执操作"
},
"calendarAction": {
"createCalendarEvent": {
"startTime": "2022-12-08",
"endTime": "2022-12-09",
"title": "结婚纪念日",
"description": "5201314"
}
}
}
}
]
}
]
}
},
"suggestion": [
{
"action": {
"displayText": "打开链接",
"postback": {
"data": "回执操作"
},
"urlAction": {
"openUrl": {
"url": "https://www.baidu.com",
"application": "browser"
}
}
}
}
]
},
"templateId": "8133d5bb124341019367e0bdc77484ae",
"templateName": "多卡片模板+ch5回落(建议菜单:撰写消息+设置日历,悬浮菜单:打开链接)",
"draft": 0
}4.5、地理位置模板+视信回落

地理位置+悬浮菜单(展示位置+查询位置)+视信回落
POST http://127.0.0.1:8002/rcs/template/editTemplate/a92e43085a0049ba8928b61fa04eeee
Authorization:
ZGgxODUyODpjNDFkZTdmNDhlZTEwYjcxMWQ3MzEzNzFlZTI3NDY5YQ==
Date: 2023-06-02 08:54:38
Content-Type: application/json
User-Agent: Apifox/1.0.0 (https://www.apifox.cn)
Accept: */*
Host: 127.0.0.1:8002
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length:1641
{
"fallbackContent": "14aad893e72d425aba81b380102fb7f5",
"fallbackType": 2,
"message": {
"contentType": "text/plain",
"contentText": "geo:39.915031,116.403978;crs=gcj02;u=10;rcs-l=展示信息",
"contentEncoding": "utf8",
"suggestion": [
{
"action": {
"displayText": "展示位置",
"postback": {
"data": "回执操作"
},
"mapAction": {
"showLocation": {
"location": {
"longitude": "116.403978",
"latitude": "39.915031",
"label": "天安门"
}
}
}
}
},
{
"action": {
"displayText": "查询位置",
"postback": {
"data": "回执操作"
},
"mapAction": {
"showLocation": {
"location": {
"query": "天安门",
"label": "天安门"
}
}
}
}
}
]
},
"templateId": "636d38d8349a48d8a898dcd61d9946ba",
"templateName": "地理位置模板+视信回落(菜单:展示位置+查询位置)",
"draft": 0
}4.6、单卡片(动态参数)+智能消息(动态参数)

单卡片(动态参数)+智能消息(动态参数)
POST http://127.0.0.1:8002/rcs/template/editTemplate/a92e43085a0049ba8928b61fa04eeee
Authorization: ZGgxODUyODoyYTVhNGFmMWUxZTljNjAyNjcwYjVmOTc5NDhiZGJkMA==
Date: 2023-05-23 15:28:26
Content-Type: application/json
User-Agent: Apifox/1.0.0 (https://www.apifox.cn)
Accept: */*
Host: 127.0.0.1:8002
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 2154
{
"fallbackType":4,
"fallbackContent": "d738580ee47b4ef88c90b947b5eecad7",
"message": {
"contentType": "application/vnd.gsma.botmessage.v1.0+json",
"contentEncoding": "utf8",
"contentText": {
"generalPurposeCard": {
"layout": {
"cardOrientation": "VERTICAL",
"titleFontStyle": [
"bold"
],
"descriptionFontStyle": [
"italics"
]
},
"content": {
"media": {
"mediaId": "material_000001",
"height": "TALL_HEIGHT"
},
"title": "卡片${title}",
"description": "卡片${description}",
"suggestions": [
{
"action": {
"displayText": "短信草稿",
"postback": {
"data": "回执操作"
},
"composeAction": {
"composeTextMessage": {
"phoneNumber": "15766666666",
"text": "消息内容"
}
}
}
}
]
}
}
},
"suggestion": [
{
"action": {
"displayText": "打开链接",
"postback": {
"data": "回执操作"
},
"urlAction": {
"openUrl": {
"url": "https://www.baidu.com",
"application": "browser"
}
}
}
},
{
"action": {
"displayText": "地理位置/展示位置",
"postback": {
"data": "回执操作"
},
"mapAction": {
"showLocation": {
"location": {
"longitude": "116.403978",
"latitude": "39.915031",
"label": "标签"
}
}
}
}
}
]
},
"templateId": "03d905759f9247d78f325926346ee612",
"templateName": "单卡片(动态参数)+智能消息(动态参数)",
"draft": 0
}5、响应参数
| 名称 | 数据类型 | 是否必有 | 描述 | |
|---|---|---|---|---|
| code | int | 是 | 响应状态码 | |
| desc | string | 是 | 请求响应描述 | |
6、响应示例
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Date: Mon, 15 May 2023 02:10:40 GMT
Connection: close
{
"code": 0,
"desc": "请求成功"
}文档更新时间: 2025-12-17 09:34 作者:王超