Ordinary message sending v1

Last updated:2022-3-22
Expand all
Ordinary message sending v1

API Overview

Function description

Sent by ordinary message API You can freely choose the sending channel and fill in the message content. The message fields of each channel completely follow the requirements of the channel itself.

You can choose to send a message to a single user or a list of users.

Calling address

Broadcast sending:POST https://api.ums.jiguang.cn/v1/broadcast

Other ways to send:POST https://api.ums.jiguang.cn/v1/sent

Call verification

HTTP Header(Header) Add a field ( Key/Value right):

Authorization: Basic base64_auth_string
          Authorization: Basic base64_auth_string

        
This code block is shown in the floating window

in base64_auth_string The generation algorithm is:base64(ChannelKey:MasterSecret)
That is, to ChannelKey Add a colon, add MasterSecret Assemble the string and then do base64 Convert.

message object

a message object to JSON Format expression represents all information related to a message.

parameter type Options illustrate
aud_xxx String Array Optional 1. The destination of the message, when calling the broadcast API There is no need to pass this field.
2. xxxSee below for details on the values ​​of some parts. aud_xxx Send destination part.
msg_xxx Object Array Required The message content of each channel,xxx See below for details on the values ​​of some parts. msg_xxx Message content part.
rule_id int Optional Send policy ID. If sending at the same time, 0 or not can be sent. This field has no effect when sending with a custom channel ID.
option JSON Object Optional Optional parameters, used to fill in the blacklist ID, submitter and other information
callback JSON Object Optional callback parameters

Example description

Request example

curl --insecure -X POST -v https://api.ums.jiguang.cn/v1/sent -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1" -d ' { "aud_userid": ["user1","user2"], "msg_app": [{"platform":"android", "notification":{"android":{"alert":"Hi,JPush !"}}}], "rule_id": 1001, "option": { "sendno": "test", "owner":"admin", "black_id":1234, "priority":2 }, "callback": { "url":"https://www.jiguang.cn/ums-portal", "params":{ "name":"joe", "age":26 } } }' > POST /v3/push HTTP/1.1 > Authorization: Basic N2Q0MzFlNDJkZmE2YTZkNjkzYWMyZDA0OjVlOTg3YWM2ZDJlMDRkOTVhOWQ4ZjBkMQ==
          curl --insecure -X POST -v https://api.ums.jiguang.cn/v1/sent -H "Content-Type: application/json" -u "7d431e42dfa6a6d693ac2d04:5e987ac6d2e04d95a9d8f0d1" -d '
{
    "aud_userid": ["user1","user2"],
    "msg_app": [{"platform":"android", "notification":{"android":{"alert":"Hi,JPush !"}}}],
    "rule_id": 1001,
    "option": {
        "sendno": "test",
        "owner":"admin",
        "black_id":1234,
        "priority":2
    },
    "callback": {
        "url":"https://www.jiguang.cn/ums-portal",
        "params":{
            "name":"joe",
            "age":26
         }
    }
}'

> POST /v3/push HTTP/1.1
> Authorization: Basic N2Q0MzFlNDJkZmE2YTZkNjkzYWMyZDA0OjVlOTg3YWM2ZDJlMDRkOTVhOWQ4ZjBkMQ==

        
This code block is shown in the floating window

Return parameters and examples

parameter type Options illustrate
code int Required Business status code, 0 represents success, others represent failure, see call return code for details
msgid String Optional Message unique ID, not returned on failure.
sendno String Optional API The identifier passed when calling will be returned unchanged when the request is successful.
message String Optional Reason for failure, returned on failure
< HTTP/1.1 200 OK < Content-Type: application/json {"code":0,"sendno":"aeg-efd-0e","msgid":"v:1t:1603707455p:27133n:2"}
          < HTTP/1.1 200 OK
< Content-Type: application/json
{"code":0,"sendno":"aeg-efd-0e","msgid":"v:1t:1603707455p:27133n:2"}

        
This code block is shown in the floating window
{"code":1015005,"message":"渠道已关闭"}
          {"code":1015005,"message":"渠道已关闭"}

        
This code block is shown in the floating window

aud_xxx:Send target

UMS Currently supports "broadcast owner, label, user ID,user segment、Customized channel registration ID 》5 kinds of goals

broadcast

When broadcasting to everyone, call the broadcast-specific API https://api.ums.jiguang.cn/v1/broadcast, no need to pass Audience。

User class target

"Broadcast, tag, user ID,user segment” are based on UMS User system in, you need to use it firstUser management APIUpload the user, the registration ID of each channel, and the binding relationship between the user and the registration ID of each channel.

Use this method to send messages,UMS Before sending messages to each channel, the channel registration ID will be filtered out according to specific rules, as explained below:

  • When sending a label, first filter out the ones that have the label set. userID(Priority is given to selecting the binding identifier for this label as this channel. Channelkey of userID, if this channel does not have this label, the binding identifier will be selected as global all of userID), and then filter the corresponding channel registration ID for distribution.
  • for App,WeChatOfficial Account,WeChatMini-program, Alipay Life Account Channel,userID It is bound to the channel registration ID through the channel code, so select the channel registration ID bound to the "channel authorized by this channel" in the user information to issue it.
  • For SMS and email channels, give priority to this channel in user information. Channelkey The bound mobile phone number and email address. If not available, select the globally bound mobile phone number and email address.
  • For DingTalk channels, the ID is globally unique, so select the globally bound DingTalk registration ID in the user information for delivery.

For "label, user ID,user segment"The parameter description of " is as follows:

parameter type Options illustrate
aud_tag String Array Optional Tag list, up to 20 sent at a time. Validity statement:
  • Chinese and English, numbers, underline, special characters @!#$&*+=.|¥.
  • Length should not exceed 40 bytes (UTF-8 coding)
aud_userid String Array Optional User list, most sent at one time 1000 indivual. Validity statement:
  • Uppercase and lowercase letters, numbers, underscores, special characters @!#$&*+=.|¥.
  • No more than 64 characters in length
aud_segment String Array Optional Created on pageuser segmentID. Defined as an array, but currently limited to sending one at a time.

Custom channel registration ID

If you do not upload users,UMS It also supports sending messages directly using the registration ID of each channel. Depending on the channel,xxx The value of the part is:

* App:app * 微信公众号:wechatoa * 微信小程序:wechatmp * 短信:sms * 邮箱:email * 支付宝生活号:alipay_life * 钉钉:dingtalk_cc * 企业微信:wechatwk * 企业微信互联企业:wechatwk_linkedcorp
          * App:app
* 微信公众号:wechatoa
* 微信小程序:wechatmp
* 短信:sms
* 邮箱:email
* 支付宝生活号:alipay_life
* 钉钉:dingtalk_cc
* 企业微信:wechatwk
* 企业微信互联企业:wechatwk_linkedcorp

        
This code block is shown in the floating window

Note: In one message, the custom channel registration ID and user class target (tag, user ID,user segment) are not allowed to exist simultaneously

Can send to multiple channels at the same time, each channel can send up to 1000 IDs

When sending a message using a custom channel ID,aud_xxx The type is Object Array, the description is as follows:

parameter type Options illustrate
instance String Optional Target ID, reserved field, currently invalid
data String Array Required List of channel registration IDs. Send most at one time 1000 indivual. The validity just needs to follow the requirements of each channel.

Example

  • Send with label
{ "aud_tag": ["tag1","tag2"] }
          {
    "aud_tag": ["tag1","tag2"]
}

        
This code block is shown in the floating window
  • Send using user ID
{ "aud_userid": ["user1","user2"] }
          {
    "aud_userid": ["user1","user2"]
}

        
This code block is shown in the floating window
  • useuser segmentsend
{ "aud_segment": ["1000"] }
          {
    "aud_segment": ["1000"]
}

        
This code block is shown in the floating window
  • Send using custom channel registration ID:
{ "aud_app": [{ "instance": "app", "data": ["170976fa8a9277fac6e"] }], "aud_wechatoa": [{ "instance": "wechatoa", "data": ["oMtZu6kApZYEPJJWwyIHpWQ2L_DI"] }], "aud_wechatmp": [{ "instance": "wechatmp", "data": ["oXNQs5B3LGA3xkU7-g2SdK3SsUaw"] }], "aud_sms": [{ "instance": "sms", "data": ["18866007799"] }], "aud_email": [{ "instance": "email", "data": ["support@jiguang.cn"] }], "aud_alipay_life": [{ "instance": "alipaylife", "data": ["2088102733318286"] }], "aud_dingtalk_cc": [{ "instance": "dingtalkcc", "data": ["a3c213779d163837895b30f47aaa94c3"] }], "aud_wechatwk": [{ "instance": "wechatwk", "data": ["zhangsan"] }], "aud_wechatwk_linkedcorp": [{ "instance": "wechatwk_linkedcorp", "data": ["CorpId1/userid1","CorpId2/userid2"] }] }
          {
    "aud_app": [{
      "instance": "app",
      "data": ["170976fa8a9277fac6e"]
    }],
    "aud_wechatoa": [{
      "instance": "wechatoa",
      "data": ["oMtZu6kApZYEPJJWwyIHpWQ2L_DI"]
    }],
    "aud_wechatmp": [{
      "instance": "wechatmp",
      "data": ["oXNQs5B3LGA3xkU7-g2SdK3SsUaw"]
    }],
    "aud_sms": [{
      "instance": "sms",
      "data": ["18866007799"]
    }],
    "aud_email": [{
      "instance": "email",
      "data": ["support@jiguang.cn"]
    }],
    "aud_alipay_life": [{
      "instance": "alipaylife",
      "data": ["2088102733318286"]
    }],
    "aud_dingtalk_cc": [{
      "instance": "dingtalkcc",
      "data": ["a3c213779d163837895b30f47aaa94c3"]
    }],
    "aud_wechatwk": [{
      "instance": "wechatwk",
      "data": ["zhangsan"]
    }],
    "aud_wechatwk_linkedcorp": [{
      "instance": "wechatwk_linkedcorp",
      "data": ["CorpId1/userid1","CorpId2/userid2"]
    }]
}

        
This code block is shown in the floating window

msg_xxx: Message content

When a normal message is sent, the message content completely follows the requirements of the channel itself. Depending on the channel,xxx The value of the part is:

* App:app * 微信公众号:wechatoa * 微信小程序:wechatmp * 短信:sms * 邮箱:email * 支付宝生活号:alipay_life * 钉钉:dingtalk_cc * 企业微信:wechatwk
          * App:app
* 微信公众号:wechatoa
* 微信小程序:wechatmp
* 短信:sms
* 邮箱:email
* 支付宝生活号:alipay_life
* 钉钉:dingtalk_cc
* 企业微信:wechatwk

        
This code block is shown in the floating window

Filled in the request body msg_xxx Decide which channels this message will be sent to.

  • If sent using a custom channel registration ID,aud_xxx and msg_xxx One-to-one correspondence is required.
  • If a sending policy is used, the channels and msg_xxx The channel information in needs to be consistent.
  • When sending to connected enterprises on Enterprise WeChat, share it with Enterprise WeChat msg_wechatwk。

msg_app:App information

current UMS Default dockingJPush,therefore App Please refer to the message content of JPush REST API

JPush Most parameters that support sending can be passed here. Unsupported parameters are: callback 、Audience 、VOIP

"msg_app":[{ "cid": "8103a4c628a0b98974ec1949-711261d4-5f17-4d2f-a855-5e5a8909b26e", "platform": "all", "notification": { "android": { "alert": "Hi, JPush!", "title": "Send to Android", "builder_id": 1, "large_icon": "http://www.jiguang.cn/largeIcon.jpg", "intent": { "url": "intent:#Intent;component=com.jiguang.push/com.example.jpushdemo.SettingActivity;end", }, "extras": { "newsid": 321 } }, "ios": { "alert": "Hi, JPush!", "sound": "default", "badge": "+1", "thread-id": "default" "extras": { "newsid": 321 } } "quickapp": { "alert": "Hi, JPush!", "title": "Send to QuickApp", "page": "/page1" } }, "message": { "msg_content": "Hi,JPush", "content_type": "text", "title": "msg", "extras": { "key": "value" } }, "options": { "time_to_live": 60, "apns_production": false, "apns_collapse_id":"jiguang_test_201706011100" } }]
          "msg_app":[{
    "cid": "8103a4c628a0b98974ec1949-711261d4-5f17-4d2f-a855-5e5a8909b26e",
    "platform": "all",
    "notification": {
        "android": {
            "alert": "Hi, JPush!",
            "title": "Send to Android",
            "builder_id": 1,
            "large_icon": "http://www.jiguang.cn/largeIcon.jpg",
            "intent": {
                "url": "intent:#Intent;component=com.jiguang.push/com.example.jpushdemo.SettingActivity;end",
            },
            "extras": {
                "newsid": 321
            }
        },
        "ios": {
            "alert": "Hi, JPush!",
            "sound": "default",
            "badge": "+1",
            "thread-id": "default"
            "extras": {
                "newsid": 321
            }
        }
        "quickapp": {
            "alert": "Hi, JPush!",
            "title": "Send to QuickApp",
            "page": "/page1"
        }
    },
    "message": {
        "msg_content": "Hi,JPush",
        "content_type": "text",
        "title": "msg",
        "extras": {
            "key": "value"
        }
    },
    "options": {
        "time_to_live": 60,
        "apns_production": false,
        "apns_collapse_id":"jiguang_test_201706011100"
    }
}]

        
This code block is shown in the floating window

msg_wechatoa:WeChatOfficial Accountinformation

WeChatOfficial Accountsupporttemplate messageSubscribe to notifications 2 types, passed type distinguish. except the receiver openID quilt UMS In addition to the target field substitution, the relevant parameters in the official documents can be passed here.

parameter type Options illustrate
type int Required Message type, 0-template message, 1-subscription notification

Template message parameters

parameter type Options illustrate
type int Required Message type, the value of template message type is 0
template_id String Required Template ID
url String Optional Template jump link
miniprogram JSON Object Optional JumpMini-programRequired data, no need to jumpMini-programThere is no need to send this data.url and miniprogram If you don’t fill it in at the same time, there will be no jump;page and miniprogram Fill in at the same time, jump firstMini-program
appid String Optional Need to jump toMini-programappid(ShouldMini-programappidMust be sent with the template messageOfficial AccountIt is a binding association relationship and does not support mini-games yet)
pagepath String Optional Need to jump toMini-programThe specific page path supports parameters, (exampleindex?foo=bar), requiring theMini-programReleased, mini-games are not supported yet
data JSON Object Required Template content, the format is {"key1":{"value": any,"color":"#173177"},"key2":{"value":any}}
color String Optional The font color of the template content. If not filled in, the default is black.
"msg_wechatoa": [{ "type": 0, "template_id":"ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY", "url":"http://weixin.qq.com/download", "miniprogram":{ "appid":"xiaochengxuappid12345", "pagepath":"index?foo=bar" }, "data":{ "first": { "value":"恭喜你购买成功!", "color":"#173177" }, "keyword1":{ "value":"巧克力", "color":"#173177" }, "keyword2": { "value":"39.8元", "color":"#173177" }, "keyword3": { "value":"2014年9月22日", "color":"#173177" }, "remark":{ "value":"欢迎再次购买!", "color":"#173177" } } }]
          "msg_wechatoa": [{
    "type": 0,
    "template_id":"ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY",
    "url":"http://weixin.qq.com/download",
    "miniprogram":{
        "appid":"xiaochengxuappid12345",
        "pagepath":"index?foo=bar"
    },
    "data":{
             "first": {
                "value":"恭喜你购买成功!",
                "color":"#173177"
            },
            "keyword1":{
                "value":"巧克力",
                "color":"#173177"
            },
            "keyword2": {
                "value":"39.8元",
                "color":"#173177"
            },
            "keyword3": {
                "value":"2014年9月22日",
                "color":"#173177"
            },
            "remark":{
                "value":"欢迎再次购买!",
                "color":"#173177"
            }
    }
}]

        
This code block is shown in the floating window

Subscription notification parameters

parameter type Options illustrate
type int Required Message type, subscription notification type value is 1
template_id String Required Template ID
page String Optional Jump to web page
miniprogram JSON Object Optional JumpMini-programRequired data, no jump requiredMini-programThere is no need to send this data.page and miniprogram If you don’t fill it in at the same time, there will be no jump;page and miniprogram Fill in at the same time, jump firstMini-program
appid String Optional Need to jump toMini-programappid(ShouldMini-programappidMust be sent with the template messageOfficial AccountIt is a binding association relationship and does not support mini-games yet)
pagepath String Optional Need to jump toMini-programThe specific page path supports parameters, (exampleindex?foo=bar), requiring theMini-programReleased, mini-games are not supported yet
data JSON Object Required Template content, the format is {"key1":{"value": any,"color":"#173177"},"key2":{"value":any}}, please refer to the official documentation for parameter restrictions.
"msg_wechatoa": [{ "type": 1, "template_id":"ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY", "page":"http://weixin.qq.com/download", "miniprogram":{ "appid":"xiaochengxuappid12345", "pagepath":"index?foo=bar" }, "data": { "name1": { "value": "广州腾讯科技有限公司" }, "thing8": { "value": "广州腾讯科技有限公司" }, "time7": { "value": "2019年8月8日" } } }]
          "msg_wechatoa": [{
    "type": 1,
    "template_id":"ngqIpbwh8bUfcSsECmogfXcV14J0tQlEpBO27izEYtY",
    "page":"http://weixin.qq.com/download",
    "miniprogram":{
        "appid":"xiaochengxuappid12345",
        "pagepath":"index?foo=bar"
    },
    "data": {
      "name1": {
          "value": "广州腾讯科技有限公司"
      },
      "thing8": {
          "value": "广州腾讯科技有限公司"
      },
       "time7": {
          "value": "2019年8月8日"
      }
     }
}]

        
This code block is shown in the floating window

msg_wechatmp:WeChatMini-programinformation

WeChatMini-programsupporttemplate message, except the receiver openID quilt UMS In addition to the target field substitution, the relevant parameters in the official documents can be passed here.

parameter type Options illustrate
template_id String Required Template ID
page String Optional The jump page after clicking the template card is only for thisMini-programpages within. Supports parameters, (exampleindex?foo=bar). If this field is not filled in, the template will not jump.
data JSON Object Required Template content, the format is {"key1":{"value": any},"key2":{"value":any}}
miniprogram_state String Optional JumpMini-programtype:developerFor development version;trialFor trial version;formalis the official version; the default is the official version
lang String Optional EnterMini-programView" language type, supportedzh_CN(Simplified Chinese),en_US(English),zh_HK(Traditional Chinese),zh_TW(Traditional Chinese), default iszh_CN
"msg_wechatmp": [{ "template_id": "TEMPLATE_ID", "page": "index", "miniprogram_state":"developer", "lang":"zh_CN", "data": { "number01": { "value": "339208499" }, "date01": { "value": "2015年01月05日" }, "site01": { "value": "TIT创意园" } , "site02": { "value": "广州市新港中路397号" } } }]
          "msg_wechatmp": [{
  "template_id": "TEMPLATE_ID",
  "page": "index",
  "miniprogram_state":"developer",
  "lang":"zh_CN",
  "data": {
      "number01": {
          "value": "339208499"
      },
      "date01": {
          "value": "2015年01月05日"
      },
      "site01": {
          "value": "TIT创意园"
      } ,
      "site02": {
          "value": "广州市新港中路397号"
      }
  }
}]

        
This code block is shown in the floating window

msg_sms: SMS message

JSMS

current UMS Default dockingJSMS, so useJSMSPlease refer to the message content at that time Send SMS API A single template message in

parameter type Options illustrate
sign_id String Optional Signature ID. If this field is empty, the application default signature will be used.
temp_id int Required Template ID
temp_para JSON Object Required Template parameters, parameter names that need to be replaced and value key-value pairs
"msg_sms": [{ "sign_id": "1", "temp_id": 1, "temp_para": {"code":"1234"} }]
          "msg_sms": [{
      "sign_id": "1",
      "temp_id": 1,
      "temp_para": {"code":"1234"}
    }]

        
This code block is shown in the floating window

CMPP Short message

use CMPP The docking SMS platform only needs to transmit the text message content content, examples are as follows:

"msg_sms": [{ "content":"您登录系统的动态码为:111 ,动态码有效时间为1分钟,请注意保密。" }]
          "msg_sms": [{
      "content":"您登录系统的动态码为:111 ,动态码有效时间为1分钟,请注意保密。"
    }]

        
This code block is shown in the floating window

msg_email: Email message

Email messages support the transmission of email headers and email content.

parameter type Options illustrate
subject string Required Email title
text string Required Email content, support HTML Format
files Object Array Optional Email attachment
1. UseMaterial management interfaceUpload the attachment and you will getURLPass value here
2. Make anyURLThe address is passed here. It must be ensured that the address can beUMSaccess
"msg_email": [{ "subject": "hello, ums email!", "text": "ums email test. reply", "files": ["填写url1","填写url2"] }]
            "msg_email": [{
    "subject": "hello, ums email!",
    "text": "ums email test. reply",
    "files": ["填写url1","填写url2"]
  }]

        
This code block is shown in the floating window

msg_alipay_life:Alipay Life Account News

The current Alipay Life Account supports sendingtemplate message, the parameter description is as follows:

parameter type Options illustrate
template_id String Required Message template ID, maximum length 128
context JSON Object Required Message template context, that is, the parameters and parameter values ​​defined in the template

context Field

context The parameters that can be passed are as follows:

parameter type Options illustrate
head_color String Required Color value of the top color bar, maximum length 10
url String Required The address of the page to be taken after clicking on the message, the maximum length 256
action_name String Required The bottom link description text, such as "View Details", can contain up to 8 Chinese characters or 16 English characters.
keyword1 JSON Object Optional The value of the placeholder in the template (value) and text color (color), required if the applied template contains this placeholder. If there are multiple, please fill in multiple, such askeyword2、keyword3 wait.value maximum length 128
first JSON Object Optional The value of the placeholder in the template (value) and text color (color),first Generally, it is a placeholder for the opening sentence. If the applied template contains this placeholder, it is required.
remark JSON Object Optional The value of the placeholder in the template (value) and text color (color),remark Generally, it is a placeholder for the conclusion. If the applied template contains this placeholder, it is required.
"msg_alipay_life": [{ "template_id": "e5326c1d5c71419893646ad9571a93e8", "context":{ "head_color": "#85be53", "url":"http://www.baidu.com", "action_name": "查看详情", "keyword1": { "color": "#85be53", "value": "你已经激活了上火星指令"}, "keyword2": { "color": "#85be53", "value": "2020 09-29"}, "first": { "color": "#85be53", "value": "HI.真的 已经激活了指令"}, "remark": { "color": "#85be53", "value": "指令已经通过"} } }]
            "msg_alipay_life": [{
      "template_id": "e5326c1d5c71419893646ad9571a93e8",
      "context":{
        "head_color": "#85be53",
        "url":"http://www.baidu.com",
        "action_name": "查看详情",
        "keyword1": {
            "color": "#85be53",
            "value": "你已经激活了上火星指令"},
        "keyword2": {
            "color": "#85be53",
            "value": "2020 09-29"},
        "first": {
            "color": "#85be53",
            "value": "HI.真的 已经激活了指令"},
        "remark": {
            "color": "#85be53",
            "value": "指令已经通过"}
        }
    }]

        
This code block is shown in the floating window

msg_dingtalk_cc:DingTalk work notice

Current DingTalk work notifications can be senttext message

text message

parameter type Options illustrate
msgtype String Required Message type, text message type is:text。
content String Required Message content, suggestions500within characters.
"msg_dingtalk_cc": [{ "msg":{ "msgtype": "text", "text": { "content":"test" } } }]
          "msg_dingtalk_cc": [{
      "msg":{
        "msgtype": "text",
        "text": {
          "content":"test"
        }
      }
    }]

        
This code block is shown in the floating window

msg_wechatwk:Enterprise WeChat

The message types supported by Enterprise WeChat include: text messages, picture messages, file messages, external link graphic messages, graphic messages,Mini-programnotification message. refer toOfficial documentation

Enterprise WeChat also supports sending to Qiwei Internet users. The message format is consistent with the enterprise's sending. Please refer toOfficial documentation, so you only need to send the message content once,UMS The system will be based on aud The settings are automatically routed to Internet enterprise users or users of this enterprise.

text message

parameter type Options illustrate
msgtype String Required Message type, text message type is:text。
content String Required Message content, no longer than 2048 bytes.
safe int Optional Indicates whether the message is confidential, 0 means it can be shared externally, 1 means it cannot be shared and the content displays a watermark, the default is 0
enable_duplicate_check int Optional Indicates whether to enable duplicate message checking, 0 means no, 1 means yes, the default is 0
duplicate_check_interval int Optional Indicates whether to repeat the message check time interval, default1800s, no more than 4 hours at most
"msg_wechatwk": [{ "msgtype": "text", "text": { "content": "你的快递已到,请携带工卡前往邮件中心领取,聪明避开排队。" }, "safe": 0, "enable_duplicate_check": 1, "duplicate_check_interval": 1800 }]
          "msg_wechatwk": [{
    "msgtype": "text",
    "text": {
        "content": "你的快递已到,请携带工卡前往邮件中心领取,聪明避开排队。"
    },
    "safe": 0,
    "enable_duplicate_check": 1,
    "duplicate_check_interval": 1800
}]

        
This code block is shown in the floating window

Picture message

parameter type Options illustrate
msgtype String Required Message type, picture message type is:image。
media_id String Required The ID of the image media file can be obtained by calling the upload temporary material interface.
safe int Optional Indicates whether the message is confidential, 0 means it can be shared externally, 1 means it cannot be shared and the content displays a watermark, the default is 0
enable_duplicate_check int Optional Indicates whether to enable duplicate message checking, 0 means no, 1 means yes, the default is 0
duplicate_check_interval int Optional Indicates whether to repeat the message check time interval, default1800s, no more than 4 hours at most
"msg_wechatwk": [{ "msgtype": "image", "image": { "media_id": "MEDIA_ID" }, "safe": 0, "enable_duplicate_check": 1, "duplicate_check_interval": 1800 }]
          "msg_wechatwk": [{
    "msgtype": "image",
    "image": {
        "media_id": "MEDIA_ID"
    },
    "safe": 0,
    "enable_duplicate_check": 1,
    "duplicate_check_interval": 1800
}]

        
This code block is shown in the floating window

file message

parameter type Options illustrate
msgtype String Required Message type, file message type is:file。
media_id String Required The file ID can be obtained by calling the upload temporary material interface.
safe int Optional Indicates whether the message is confidential, 0 means it can be shared externally, 1 means it cannot be shared and the content displays a watermark, the default is 0
enable_duplicate_check int Optional Indicates whether to enable duplicate message checking, 0 means no, 1 means yes, the default is 0
duplicate_check_interval int Optional Indicates whether to repeat the message check time interval, default1800s, no more than 4 hours at most
"msg_wechatwk": [{ "msgtype": "file", "file": { "media_id": "1Yv-zXfHjSjU-7LH-GwtYqDGS-zz6w22KmWAT5COgP7o" }, "safe": 0, "enable_duplicate_check": 1, "duplicate_check_interval": 1800 }]
          "msg_wechatwk": [{
    "msgtype": "file",
    "file": {
        "media_id": "1Yv-zXfHjSjU-7LH-GwtYqDGS-zz6w22KmWAT5COgP7o"
    },
    "safe": 0,
    "enable_duplicate_check": 1,
    "duplicate_check_interval": 1800
}]

        
This code block is shown in the floating window
parameter type Options illustrate
msgtype String Required Message type, the external link graphic and text message type is:news。
articles JSON Object Required Graphic and text messages, one graphic message supports 1 to 8 graphic and text messages
title String Required title, no more than128bytes
description String Optional description, no more than512bytes
url String Optional The link that jumps after clicking, the longest2048byte. Please make sure to include the protocol header (http/https),Mini-programorurlMust fill in one
picurl String Optional Cover image link for graphic messages, supportedJPG、PNGFormat, the best effect is a large image 1068*455, thumbnail150*150。
appid String Optional Mini-programappid, must be associated with the current applicationMini-program,appidandpagepathMust be filled in at the same time, it will be ignored after filling inurlField
pagepath String Optional After clicking on the message cardMini-programPage, only thisMini-programpages within.appidandpagepathMust be filled in at the same time, it will be ignored after filling inurlField
enable_duplicate_check int Optional Indicates whether to enable duplicate message checking, 0 means no, 1 means yes, the default is 0
duplicate_check_interval int Optional Indicates whether to repeat the message check time interval, default1800s, no more than 4 hours at most
"msg_wechatwk": [{ "msgtype": "news", "news": { "articles": [{ "title": "中秋节礼品领取", "description": "今年中秋节公司有豪礼相送", "url": "URL", "picurl": "http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png" }] }, "safe": 0, "enable_duplicate_check": 1, "duplicate_check_interval": 1800 }]
          "msg_wechatwk": [{
    "msgtype": "news",
    "news": {
        "articles": [{
                "title": "中秋节礼品领取",
                "description": "今年中秋节公司有豪礼相送",
                "url": "URL",
                "picurl": "http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png"
        }]
    },
    "safe": 0,
    "enable_duplicate_check": 1,
    "duplicate_check_interval": 1800
}]

        
This code block is shown in the floating window

Graphic message

The difference between graphic messages and external link graphic messages is that you can fill in specific content, which will be stored in Enterprise WeChat

parameter type Options illustrate
msgtype String Required Message type, graphic message type is:mpnews。
articles JSON Object Required Graphic and text messages, one graphic message supports 1 to 8 graphic and text messages
thumb_media_id String Required Graphic message thumbnail media_id, which can be obtained through the material management interface. here thumb_media_id That is, what is returned by the upload interface media_id
title String Required title, no more than 128 bytes
content String Required The content of graphic messages supports html label, no more than 666 K bytes
digest String Optional Description of graphic message, no more than 512 bytes
author String Optional Author of graphic message, no more than 64 bytes
content_source_url String Optional Click on the page link after "Read the original text" of the graphic message
safe int Optional Indicates whether the message is confidential, 0 means it can be shared externally (default), 1 means it cannot be shared and the content shows a watermark, 2 means it can only be shared within the enterprise.
enable_duplicate_check int Optional Indicates whether to enable duplicate message checking, 0 means no, 1 means yes, the default is 0
duplicate_check_interval String Optional Indicates whether to repeat the message check time interval, default1800s, no more than 4 hours at most
"msg_wechatwk": [{ "msgtype": "mpnews", "mpnews": { "articles": [{ "thumb_media_id": "MEDIA_ID", "title": "Title", "content": "Content", "digest": "Digest description", "author": "Author", "content_source_url": "URL" }] }, "safe": 0, "enable_duplicate_check": 1, "duplicate_check_interval": 1800 }]
          "msg_wechatwk": [{
    "msgtype": "mpnews",
    "mpnews": {
        "articles": [{
            "thumb_media_id": "MEDIA_ID",
            "title": "Title",
            "content": "Content",
            "digest": "Digest description",
            "author": "Author",
            "content_source_url": "URL"
        }]
    },
    "safe": 0,
    "enable_duplicate_check": 1,
    "duplicate_check_interval": 1800
}]

        
This code block is shown in the floating window

Mini-programnotification message

parameter type Options illustrate
msgtype String Required message type,Mini-programNotification message types are:miniprogram_notice。
appid String Required Mini-programappid, must be associated with the current applicationMini-program
page String Optional After clicking on the message cardMini-programPage, only thisMini-programpages within. If this field is not filled in, the message will not jump after being clicked.
title String Required Message title, length limit 4-12 Chinese characters
description String Optional Message description, length limit 4-12 Chinese characters
emphasis_first_item String Optional Whether to enlarge the first one content_item
content_item String Optional Message content key-value pairs, up to 10 allowed item
key String Required Length within 10 Chinese characters
value String Required Length within 30 Chinese characters
safe int Optional Indicates whether the message is confidential, 0 means it can be shared externally (default), 1 means it cannot be shared and the content shows a watermark, 2 means it can only be shared within the enterprise.
enable_duplicate_check int Optional Indicates whether to enable duplicate message checking, 0 means no, 1 means yes, the default is 0
duplicate_check_interval String Optional Indicates whether to repeat the message check time interval, default1800s, no more than 4 hours at most
"msg_wechatwk": [{ "msgtype": "miniprogram_notice", "miniprogram_notice": { "appid": "wx123123123123123", "page": "pages/index?userid=zhangsan&orderid=123123123", "title": "会议室预订成功通知", "description": "4月27日 16:16", "emphasis_first_item": true, "content_item": [ { "key": "会议室", "value": "402" }, { "key": "会议地点", "value": "广州TIT-402会议室" }, { "key": "会议时间", "value": "2018年8月1日 09:00-09:30" }, { "key": "参与人员", "value": "周剑轩" } ] }, "safe": 0, "enable_duplicate_check": 1, "duplicate_check_interval": 1800 }]
          "msg_wechatwk": [{
    "msgtype": "miniprogram_notice",
    "miniprogram_notice": {
        "appid": "wx123123123123123",
        "page": "pages/index?userid=zhangsan&orderid=123123123",
        "title": "会议室预订成功通知",
        "description": "4月27日 16:16",
        "emphasis_first_item": true,
        "content_item": [
            {
                "key": "会议室",
                "value": "402"
            },
            {
                "key": "会议地点",
                "value": "广州TIT-402会议室"
            },
            {
                "key": "会议时间",
                "value": "2018年8月1日 09:00-09:30"
            },
            {
                "key": "参与人员",
                "value": "周剑轩"
            }
        ]
    },
    "safe": 0,
    "enable_duplicate_check": 1,
    "duplicate_check_interval": 1800
}]

        
This code block is shown in the floating window

rule_id:Send policy

If reissuance is not required and only single-channel or multi-channel simultaneous transmission is required, there is no need to fill in the policy ID, or set it to 0.

After creating a reissue strategy in the official website console-channel-sending strategy, adjust API This can be specified using the policy ID.

  • When sending using a custom channel registration ID, the sending policy does not take effect.
  • If a sending policy is used, the channels and msg_xxx The channel information in needs to be consistent.

option: Optional parameter

Currently it contains the following optional parameters:

parameter type Options illustrate
sendno String Optional Used purely as API call identifier,API is returned unchanged for convenience API The caller matches the request with the return.
owner String Optional Submitter username, when the channel is opened api Required for message review
black_id int Optional Blacklist ID, blacklist ID and whitelist ID are not allowed to exist at the same time
white_id int Optional Whitelist ID, blacklist ID and whitelist ID are not allowed to exist at the same time
priority int Optional Message priority, values: 1 (high), 2 (medium), 3 (low)

callback: callback parameters

tune API When sending a message, you can specify callback Parameters to facilitate users to temporarily change callbacks URL Or the callback can bring its own custom parameters to meet its daily business needs. Please read detailed instructions for useMessage callback settings

This feature is only forJiguang VIP Provided by the user, 9 message statuses are provided: "Target valid/invalid, submission successful/failed, delivery successful/failed, click, withdrawal successful/failed", and the required callback status needs to be set in the official website console.

If you need to activate this function, please contact:Business customer service

Example:

{ "aud_userid": ["user1","user2"], "msg_app": [{"platform":"android", "notification":{"android":{"alert":"Hi,JPush !"}}}], "rule_id": 1001, "option": { "sendno": "test", "owner":"admin", "black_id":1234, "priority":2 }, "callback": { "url":"https://www.jiguang.cn/ums-portal", "params":{ "name":"joe", "age":26 } } }
          {
    "aud_userid": ["user1","user2"],
    "msg_app": [{"platform":"android", "notification":{"android":{"alert":"Hi,JPush !"}}}],
    "rule_id": 1001,
    "option": {
        "sendno": "test",
        "owner":"admin",
        "black_id":1234,
        "priority":2
    },
    "callback": {
        "url":"https://www.jiguang.cn/ums-portal",
        "params":{
            "name":"joe",
            "age":26
         }
    }
}

        
This code block is shown in the floating window

callback Contains the following fields:

Keywords type Options meaning
url string Optional The data temporary callback address is only valid for this message sending request. The address must be inJiguangIt can be used only if the background verification is passed; if not specified, it will be usedJiguangThe default address configured in the background shall prevail.
params JSON Object Optional Custom parameters that need to be called back to the user

call return

call API Please refer to the return code afterBusiness return code

refer to

Was this document helpful?

Copyright 2011-2026, jiguang.cn, All Rights Reserved. 粤ICP备12056275号-13 Shenzhen Hexun Huagu Information Technology Co., Ltd.

Open in Docs Center