Companies can proactively send messages to employees, with no limit on the amount of messages . When calling the interface, use the Https protocol and JSON data packet format, and the data packet does not need to be encrypted. Currently, it supports text, picture, voice, video, file, graphic and other message types. Except for news type, other types of messages can be added with confidentiality options when sending. Confidential messages will be watermarked and only the recipient can read them. 1. Sending interface description Https request method: POST https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN parameter | must | illustrate |
---|
access_token | yes | Call interface credentials |
The administrator needs to have permission to use the application and to view the recipients touser, toparty, and totag. Otherwise, the call will fail. If you do not have permission for any of the application, recipient, department, or tag, the send will fail; if the recipient, department, or tag does not exist, the send will still be executed, but the invalid part will be returned. - {
- "errcode" : 0 ,
- "errmsg" : "ok" ,
- "invaliduser" : "UserID1" ,
- "invalidparty" : "PartyID1" ,
- "invalidtag" : "TagID1"
- }
2. Message Type and Data Format - {
- "touser" : "UserID1|UserID2|UserID3" ,
- "toparty" : " PartyID1 | PartyID2 " ,
- "totag" : " TagID1 | TagID2 " ,
- "msgtype" : "text" ,
- "agentid" : "1" ,
- "text" : {
- "content" : "Holiday Request For Pony(http://xxxxx)"
- },
- "safe" : "0"
- }
parameter | must | illustrate |
---|
touser | no | UserID list (message recipients, multiple recipients are separated by '|'). Special case: specify @all to send to all members who follow the enterprise application | toparty | no | PartyID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | totag | no | TagID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | msgtype | yes | Message type, fixed at this time: text | agentid | yes | The id of the enterprise application, integer. You can view it on the application settings page. | content | yes | Message content | safe | no | Indicates whether it is a confidential message, 0 means no, 1 means yes, the default is 0 |
- {
- "touser" : "UserID1|UserID2|UserID3" ,
- "toparty" : " PartyID1 | PartyID2 " ,
- "msgtype" : "image" ,
- "agentid" : "1" ,
- "image" : {
- "media_id" : "MEDIA_ID"
- },
- "safe" : "0"
- }
parameter | must | illustrate |
---|
touser | no | UserID list (message recipients, multiple recipients are separated by '|'). Special case: specify @all to send to all members who follow the enterprise application | toparty | no | PartyID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | totag | no | TagID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | msgtype | yes | Message type, fixed at this time: image | agentid | yes | The id of the enterprise application, integer. You can view it on the application settings page. | media_id | yes | Media resource file ID | safe | no | Indicates whether it is a confidential message, 0 means no, 1 means yes, the default is 0 |
- {
- "touser" : "UserID1|UserID2|UserID3" ,
- "toparty" : " PartyID1 | PartyID2 " ,
- "totag" : " TagID1 | TagID2 " ,
- "msgtype" : "voice" ,
- "agentid" : "1" ,
- "voice" : {
- "media_id" : "MEDIA_ID"
- },
- "safe" : "0"
- }
parameter | must | illustrate |
---|
touser | no | UserID list (message recipients, multiple recipients are separated by '|'). Special case: specify @all to send to all members who follow the enterprise application | toparty | no | PartyID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | totag | no | TagID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | msgtype | yes | Message type, fixed at this time: voice | agentid | yes | The id of the enterprise application, integer. You can view it on the application settings page. | media_id | yes | Media resource file ID | safe | no | Indicates whether it is a confidential message, 0 means no, 1 means yes, the default is 0 |
- {
- "touser" : "UserID1|UserID2|UserID3" ,
- "toparty" : " PartyID1 | PartyID2 " ,
- "totag" : " TagID1 | TagID2 " ,
- "msgtype" : "video" ,
- "agentid" : "1" ,
- " video " : {
- "media_id" : "MEDIA_ID" ,
- "title" : "Title" ,
- "description" : "Description"
- },
- "safe" : "0"
- }
parameter | must | illustrate |
---|
touser | no | UserID list (message recipients, multiple recipients are separated by '|'). Special case: specify @all to send to all members who follow the enterprise application | toparty | no | PartyID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | totag | no | TagID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | msgtype | yes | Message type, fixed at this time: video | agentid | yes | The id of the enterprise application, integer. You can view it on the application settings page. | media_id | yes | Media resource file ID | title | no | Title of the video message | description | no | Description of video message | safe | no | Indicates whether it is a confidential message, 0 means no, 1 means yes, the default is 0 |
- {
- "touser" : "UserID1|UserID2|UserID3" ,
- "toparty" : " PartyID1 | PartyID2 " ,
- "totag" : " TagID1 | TagID2 " ,
- "msgtype" : "file" ,
- "agentid" : "1" ,
- "file" : {
- "media_id" : "MEDIA_ID"
- },
- "safe" : "0"
- }
parameter | must | illustrate |
---|
touser | no | UserID list (message recipients, multiple recipients are separated by '|'). Special case: specify @all to send to all members who follow the enterprise application | toparty | no | PartyID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | totag | no | TagID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | msgtype | yes | Message type, fixed at this time: file | agentid | yes | The id of the enterprise application, integer. You can view it on the application settings page. | media_id | yes | Document ID | safe | no | Indicates whether it is a confidential message, 0 means no, 1 means yes, the default is 0 |
- {
- "touser" : "UserID1|UserID2|UserID3" ,
- "toparty" : " PartyID1 | PartyID2 " ,
- "totag" : " TagID1 | TagID2 " ,
- "msgtype" : "news" ,
- "agentid" : "1" ,
- "news" : {
- "articles" :[
- {
- "title" : "Title" ,
- "description" : "Description" ,
- "url" : "URL" ,
- "picurl" : "PIC_URL" ,
- },
- {
- "title" : "Title" ,
- "description" : "Description" ,
- "url" : "URL" ,
- "picurl" : "PIC_URL" ,
- }
- ]
- }
- }
parameter | must | illustrate |
---|
touser | no | UserID list (message recipients, multiple recipients are separated by '|'). Special case: specify @all to send to all members who follow the enterprise application | toparty | no | PartyID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | totag | no | TagID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | msgtype | yes | Message type, fixed at this time: news | agentid | yes | The id of the enterprise application, integer. You can view it on the application settings page. | title | no | title | description | no | describe | url | no | Click the link to jump to. The company can verify the employee's true identity based on the code parameter in the URL. For details, please refer to "9 WeChat page jump employee identity query" | picurl | no | The image link of the picture message supports JPG and PNG formats. The best effect is 640*320 for large pictures and 80*80 for small pictures. If it is not filled, the picture will not be displayed on the client |
Note: mpnews messages are similar to news messages, except that the text and picture message content is stored in the WeChat backend and supports confidentiality options. - {
- "touser" : "UserID1|UserID2|UserID3" ,
- "toparty" : " PartyID1 | PartyID2 " ,
- "totag" : " TagID1 | TagID2 " ,
- "msgtype" : "mpnews" ,
- "agentid" : "1" ,
- "mpnews" : {
- "articles" :[
- {
- "thumb_media_id" : "id" ,
- "author" : "Author" ,
- "content_source_url" : "URL" ,
- "content" : "Content"
- "digest" : "Digest description" ,
- "show_cover_pic" : "0"
- },
- {
- "thumb_media_id" : "id" ,
- "author" : "Author" ,
- "content_source_url" : "URL" ,
- "content" : "Content"
- "digest" : "Digest description" ,
- "show_cover_pic" : "0"
- }
- ]
- "media_id" : "id"
- }
- "safe" : "0"
- }
parameter | must | illustrate |
---|
touser | no | UserID list (message recipients, multiple recipients are separated by '|'). Special case: specify @all to send to all members who follow the enterprise application | toparty | no | PartyID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | totag | no | TagID list, multiple recipients are separated by '|'. This parameter is ignored when touser is @all | msgtype | yes | Message type, fixed at this time: mpnews | agentid | yes | The id of the enterprise application, integer. You can view it on the application settings page. | articles | yes | Graphics and text messages. One graphic and text message supports 1 to 10 graphics and texts. | thumb_media_id | yes | The media_id of the picture and text message thumbnail can be obtained in the multimedia file upload interface. Here, thumb_media_id is the media_id returned by the upload interface. | title | yes | Title of the picture and text message | author | no | Author of the picture and text message | content_source_url | no | The page link after clicking "Read original text" in the picture and text message | content | yes | Content of graphic message, supports HTML tags | digest | no | Description of picture and text message | show_cover_pic | no | Whether to display the cover, 1 for display, 0 for not display | safe | no | Indicates whether it is a confidential message, 0 means no, 1 means yes, the default is 0 | |