# Preview message
Interface should be called on the server side, not in the front end (Weixin Mini Program, web pages, APP, etc.) directly called, specific reference interface call guide
Interface English name: preview
This interface sends a message to a specified user and looks at the style and layout of the message on the mobile phone.
# 1. How to call
# HTTPS calls
POST https://api.weixin.qq.com/cgi-bin/message/mass/preview?access_token=ACCESS_TOKEN
# Cloud Calls
- This interface does not support cloud calls
# Third party invocation
This interface supports Third Party Platform generation business call.
The permission set id to which the interface belongs is: 7
When a service provider is authorized by one of the permissions set, it can call on behalf of the merchant by using authorizer_access_token , which can be viewed in the third-party call documentation.
# 2. Request parameters
# Query parametersQuery String parameters
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
access_token | string | yes | Interface invocation credentials, using access_token , authorizer_access_token |
# Request BodyRequest Payload
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
touser | string | no | The user receiving the message has an openid (touser, towxname) that should be Official Account |
towxname | string | no | Receive message user WeChat number, realize the preview of WeChat ID (touser, towxname two choose one) |
msgtype | string | yes | Group message type, text message for mpnews, text message for text, voice for voice, music for music, picture for image, video for mp video, card coupon for wxcard |
mpnews | object | no | Graphic message |
text | object | no | Text Message |
voice | object | no | Voice Messages |
music | object | no | Music News |
image | object | no | Photo message |
mpvideo | object | no | Video Messages |
wxcard | object | no | Card Messages |
# Body.mpnewsObject Payload
Graphic message
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
media_id | - | no | Media_id for a message to be sent in a group |
# Body.textObject Payload
Text Message
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
content | - | no | The content of the text when text message is sent |
# Body.voiceObject Payload
Voice Messages
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
media_id | - | no | Media_id for a message to be sent in a group |
# Body.musicObject Payload
Music News
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
media_id | - | no | Media_id for a message to be sent in a group |
# Body.imageObject Payload
Photo message
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
media_id | - | no | Media_id for a message to be sent in a group |
# Body.mpvideoObject Payload
Video Messages
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
media_id | - | no | Media_id for a message to be sent in a group |
# Body.wxcardObject Payload
Card Messages
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
card_id | string | no | Voucher ID |
card_ext | object | no | Card Attributes |
# Body.wxcard.card_extObject Payload
Card Attributes
Parameter Name | type | Required to fill in | Introductions |
---|---|---|---|
code | string | no | Card voucher code |
openid | string | no | User openid |
timestamp | string | no | timestamp |
signature | string | no | autograph |
# 3. Return Parameters
# Response Payload
Parameter Name | type | Introductions |
---|---|---|
errcode | number | Error code |
errmsg | string | Error message |
# 4. Note
To meet the needs of Third Party Platform developers, the ability to send a preview to a specified WeChat number is increased while retaining the openID preview capability, but the capability is limited to 100 calls per day and should not be abused.
# 5. Code examples
Example Requests
{
"towxname":"示例的微信号",
"mpnews":{
"media_id":"123dsdajkasd231jhksad"
},
"msgtype":"mpnews"
}
Return an example
{
"errcode":0,
"errmsg":"preview success"
}
# 6. Error code
The following is a list of error codes for this interface, other error codes can refer to General error codes
Error code | Error Description | Solutions |
---|---|---|
0 | Ok or in a normal state | OK means to go from abnormal to normal in a normal state |
# 7. Scope of application
Official Account | Service Account |
---|---|
Certification only | Certification only |
- Authentication only: means that only authenticated accounts are allowed to be invoked by the enterprise entity, and accounts that are not authenticated or do not support authentication cannot be invoked.
- Other account types that are not expressly stated may not be called on this interface without special instructions;