Feedback

公共参数(WebInfo 和 Message 字段说明)

说明:
WebInfo 和 Message 均为选填字段,但二者至少需要存在一个。
仅 WebInfo 存在时只有浏览器通知栏推送。
仅 Message 存在时仅网页未被关闭时可以收到在线推送。
WebInfo 和 Message 同时存在时在线收到 Message 在线推送,离线收到 WebInfo 浏览器通知栏推送。

浏览器通知栏推送


{
//From_Account、MsgRandom、Condition等其他参数
"WebInfo": {
"Title": "webpush title",
"Desc": "即时通信 IM webpush batch",
"Ext": "{\"entity\":{\"action\":1,\"chatType\":0}}", // 透传字段,推送使用json格式字符串
"Icon": "http://icon.png",
"Image": "http://image.png",
"URL": "http://url"
}
}

在线推送

standard 样式示例:

{
// From_Account、MsgRandom、Condition、WebInfo 等其他参数
"Message": {
"MsgType": "standard",
"MsgContent": {
"Text": {
"Title": "nick",
"Desc": "hello world"
},
"Image": {
"URL": "http://xxx.png",
"LinkURL": "https://xxx.com"
},
"Close": 1,
"Placement": 8,
"Duration": 0,
"Button": [
{
"Text": "Like1",
"Icon": "http://xxx.png",
"Url": "https://xxx.com"
},
{
"Text": "Like2",
"Icon": "http://xxx.png",
"Url": "https://xxx.com"
}
]
},
"Ext": ""
}
}
html 样式示例:

{
// From_Account、MsgRandom、Condition、WebInfo 等其他参数
"Message": {
"MsgType": "html",
"MsgContent": {
"Duration": 86400,
"Placement": 8,
"Html": "PGgxPkhlbGxvPC9oMT4=" //例如,可将 <h1>Hello</h1> 编码为 PGgxPkhlbGxvPC9oMT4=
},
"Ext": ""
}
}
custom 样式示例:
Data 为字符串

{
// From_Account、MsgRandom、Condition、WebInfo 等其他参数
"Message": {
"MsgType": "custom",
"MsgContent": {
"Data": "this is custom data"
},
"Ext": ""
}
}
Data 为 JSON 对象

{
// From_Account、MsgRandom、Condition、WebInfo 等其他参数
"Message": {
"MsgType": "custom",
"MsgContent": {
"Data": {
"1": 1,
"type": "notice",
"payload": {
"id": "10001",
"content": "hello webpush"
}
}
},
"Ext": ""
}
}


在线收到 Message 在线推送,离线收到 WebInfo 浏览器通知栏推送


{
//From_Account、MsgRandom、Condition等其他参数
"WebInfo": {
"Title": "webpush title",
"Desc": "即时通信 IM webpush batch",
"Ext": "{\"entity\":{\"action\":1,\"chatType\":0}}",
"Icon": "http://icon.png",
"Image": "http://image.png",
"URL": "http://url"
},
"Message": {
"MsgType": "standard",
"MsgContent": {
"Text": {
"Title": "xxx",
"Desc": "hello world"
},
"Image": {
"URL": "http://i.imgur.com/N8SN8ZS.png",
"LinkURL": "https://www.baidu.com"
},
"Close": 1, //1-显示关闭按钮, 0-不显示关闭按钮
"Placement": 8, // 0-中间,1-左上,2-上中,3-右上,4-右中,5-右下,6-下中,7-左下,8-左中
"Duration": 86400, // 0不消失,最大值不超过86400
"Button": [
{
"Text": "Like", //文本
"Icon": "http://Icon.png", // 图标
"Url": "https://Url" // 跳转链接
},
{
"Text": "Like1", //文本
"Icon": "http://Icon.png", // 图标
"Url": "https://Url" // 跳转链接
}
]
},
"Ext": ""
}
}

WebInfo 字段说明

字段
类型
属性
说明
Title
String
选填
推送标题,限制100字符,超过会截断 。
Desc
String
必填
推送内容,限制200字符,超过会截断 。
URL
String
必填
推送点击跳转 URL。
Ext
String
选填
推送透传内容,点击时可通过客户端回调获取到,推送使用 json 格式字符串。
Icon
String
选填
推送小图标 URL 地址,建议192×192px,大小在 1M 以内。限制格式:JPG、PNG、GIF、SVG、ico。
Image
String
选填
推送大图 URL 地址,建议16:9(如320x180px),大小在 1M 以内。限制格式:JPG、PNG、GIF、SVG、ico。支持 Chrome、Opera、Yandex 浏览器。

Message 字段说明

字段
类型
属性
说明
MsgType
String
必填
推送类型,可选值:standard(标准样式)、html(HTML 样式)、custom(自定义推送)。
MsgContent
Object
必填
推送内容配置,根据不同的 MsgType 有不同的结构,详见下方说明。
Ext
String
选填
透传到客户端的内容。

MsgType 为 standard(标准样式)时的 MsgContent 字段说明

字段
类型
属性
说明
Text
Object
选填
弹窗文本,详见下方 Text 字段说明。Text 和 Image 至少填一个。
Image
Object
选填
弹窗图片,详见下方 Image 字段说明。Text 和 Image 至少填一个。
Close
Integer
选填
是否显示关闭按钮,1表示显示,0表示不显示。
Placement
Integer
选填
页面弹窗位置:0-中间,1-左上,2-上中,3-右上,4-右中,5-右下,6-下中,7-左下,8-左中。
Duration
Integer
选填
弹窗持续时间(秒):默认0表示不消失,最大值不超过86400。
Button
Object Array
选填
按钮数组,最多支持2个按钮,详见下方 Button 字段说明。
Text 字段说明
字段
类型
属性
说明
Title
String
选填
弹窗标题。
Desc
String
必填
弹窗描述内容。
Image 字段说明
字段
类型
属性
说明
URL
String
必填
弹窗图片 URL 地址。
LinkURL
String
选填
点击图片时的跳转链接地址。
Button 字段说明
字段
类型
属性
说明
Text
String
必填
按钮显示的文本内容。
Icon
String
选填
按钮图标的 URL 地址。
Url
String
选填
点击按钮时的跳转链接地址。

MsgType 为 html(HTML 样式)时的 MsgContent 字段说明

字段
类型
属性
说明
Duration
Integer
选填
弹窗持续时间(秒):0表示不消失,最大值不超过86400。
Placement
Integer
选填
页面弹窗位置:0-中间,1-左上,2-上中,3-右上,4-右中,5-右下,6-下中,7-左下,8-左中。
Html
String
必填
为防止特殊字符影响 JSON 结构,影响内容完整性或解析一致性,HTML 内容需经过 base64 编码。

MsgType 为 custom(自定义推送)时的 MsgContent 字段说明

字段
类型
属性
说明
Data
String/Object
必填
自定义数据,可以是字符串或 JSON 对象。