向已关注服务号用户推送消息
1.功能说明
服务商后台可以通过此接口,向已关注服务号的用户推送携带链接的消息,用户可通过此消息携带的链接快速进入到此消息所关联子服务中,关联功能卡片消息跳转对应子服务(WEEX子服务、H5子服务)
2.接口说明
2.1.接口定义
path |
请求方式 |
接口描述 |
调用权限 |
/openservice/sendCardMessage |
POST |
卡片消息推送 |
特有权限 |
2.2.请求头说明
名称 |
是否必须 |
类型 |
默认值 |
备注 |
Content-Type |
true |
string |
application/json |
N/A |
Authorization |
true |
string |
N/A |
添加服务级别的access_token,如:Bearer a3cc6613-ebe7-4ab8-9e25-48ed2c9d6c6a |
2.3.请求参数说明
名称 |
是否必须 |
类型 |
默认值 |
备注 |
msgId |
true |
string |
N/A |
消息id,对应推送消息的唯一值 具有唯一性校验 |
appkey |
true |
string |
N/A |
开放平台为子服务发放的APPID,对应此条卡片消息将会跳转进入的子服务APPID |
title |
true |
string |
N/A |
卡片消息的标题 |
subTitle |
false |
string |
N/A |
卡片消息的次级标题 |
content |
true |
array |
N/A |
消息主体内容,包裹对象 |
toAccount |
true |
string |
N/A |
消息接收方的app账号 |
route |
true |
object |
N/A |
将跳转进入的子服务路由信息 |
value |
依赖route字段 |
string |
N/A |
路由信息实际值iCloudCity:// 为固定内容 |
2.4.返回参数说明
名称 |
是否必须 |
类型 |
备注 |
ret |
true |
string |
请求是否正常返回状态码:"-1"请求异常 ,"0":请求成功 |
errorCode |
true |
string |
请求成功返回null,失败返回code码 |
msg |
true |
string |
成功返回"ok",失败返回错误信息 |
data |
false |
object |
成功返回数据主体,失败不返回 |
3.请求示例
{
"msgId": "123458",
"appkey": "d*****-3",
"title": "访客申请",
"subTitle": "您有新的访客拜访申请,请及时处理。",
"content": [{
"title": "申请人",
"content": "小明"
}, {
"title": "拜访时间",
"content": "2019年05月18日 12:30"
}, {
"title": "拜访事由",
"content": "前来拜访"
}],
"toAccount": "17378366479",
"route": {
"value": "iCloudCity://weex/dae4245d-3/path=index.js&mobilePhone=13530986300&name=zs"
}
}
3.1.成功返回示例
{
"ret": "0",
"errorCode": null,
"msg": "ok",
"data": null
}
成功后用户将收到如下图消息

3.2.失败返回示例
{
"errorCode": "109002",
"msg": "无权访问",
"ret": "-1"
}