# Preview message

Debugging Tools

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 NametypeRequired to fill inIntroductions
access_tokenstringyesInterface invocation credentials, using access_token , authorizer_access_token

# Request BodyRequest Payload

Parameter NametypeRequired to fill inIntroductions
touserstringnoThe user receiving the message has an openid (touser, towxname) that should be Official Account
towxnamestringnoReceive message user WeChat number, realize the preview of WeChat ID (touser, towxname two choose one)
msgtypestringyesGroup 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
mpnewsobjectnoGraphic message
textobjectnoText Message
voiceobjectnoVoice Messages
musicobjectnoMusic News
imageobjectnoPhoto message
mpvideoobjectnoVideo Messages
wxcardobjectnoCard Messages

# Body.mpnewsObject Payload

Graphic message

Parameter NametypeRequired to fill inIntroductions
media_id-noMedia_id for a message to be sent in a group

# Body.textObject Payload

Text Message

Parameter NametypeRequired to fill inIntroductions
content-noThe content of the text when text message is sent

# Body.voiceObject Payload

Voice Messages

Parameter NametypeRequired to fill inIntroductions
media_id-noMedia_id for a message to be sent in a group

# Body.musicObject Payload

Music News

Parameter NametypeRequired to fill inIntroductions
media_id-noMedia_id for a message to be sent in a group

# Body.imageObject Payload

Photo message

Parameter NametypeRequired to fill inIntroductions
media_id-noMedia_id for a message to be sent in a group

# Body.mpvideoObject Payload

Video Messages

Parameter NametypeRequired to fill inIntroductions
media_id-noMedia_id for a message to be sent in a group

# Body.wxcardObject Payload

Card Messages

Parameter NametypeRequired to fill inIntroductions
card_idstringnoVoucher ID
card_extobjectnoCard Attributes

# Body.wxcard.card_extObject Payload

Card Attributes

Parameter NametypeRequired to fill inIntroductions
codestringnoCard voucher code
openidstringnoUser openid
timestampstringnotimestamp
signaturestringnoautograph

# 3. Return Parameters

# Response Payload

Parameter NametypeIntroductions
errcodenumberError code
errmsgstringError 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 codeError DescriptionSolutions
0Ok or in a normal stateOK means to go from abnormal to normal in a normal state

# 7. Scope of application

How this interface can be invoked under different account types:
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;