Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program mediaCheckAsync


May 19, 2021 WeChat Mini Program Development Document



security.mediaCheckAsync

This interface should be called on the server side, as detailed in the Service Side API.

Asynchronously verify that the image/audio contains illegal content.

Examples of scenarios:

  1. Speech risk recognition: voice content detection published by social users;
  2. Image smart yellow: involved in taking pictures of tool-type applications (such as beauty shoot, image-type applications) users to take photos upload detection;
  3. Sensitive face recognition: user avatar, image detection in media user articles, image detection uploaded by social users, etc. Frequency limit: A single appId call is capped at 2000 times per minute, 200,000 times per day, and file size limit: a single file size does not exceed 10M

The request address

POST https://api.weixin.qq.com/wxa/media_check_async?access_token=ACCESS_TOKEN

Request parameters

Property Type The default Required Description
access_token string Is The interface calls the credentials
media_url string Is The multimedia url to detect
media_type number Is 1: Audio; 2: Pictures

Returns a value

Object

The returned JSON packet

Property Type Description
trace_id string Task id, used to match asynchronous push results
errcode number Error code
errmsg string The error message

The legal value of errcode

Value Description The lowest version
0 The detection request has been received

Object

Asynchronous detection results are pushed to your message receiving server within 30 minutes. The returned JSON packet

Property Type Description
ToUserName string Username
FromUserName string Platform push service username
CreateTime number Send time
MsgType string Default: Event
Event string Default: wxa_media_check
isrisky number Detection results, 0: No risk is detected, 1: Risk
extra_info_json string Additional information, default is empty
appid string AppID of a small program
trace_id string Task ID
status_code number Default is: 0, 4294966288 (-1008) Can't download for link

Call example

curl -d '{ "media_url":"https://developers.weixin.qq.com/miniprogram/assets/images/head_global_z_@all.png","media_type":2 }' 'https://api.weixin.qq.com/wxa/media_check_async?access_token=ACCESS_TOKEN'

Notice

media_type need to fill in the url corresponding to the multimedia type, media_url need to ensure that the detection server can be downloaded

The interface returns an example

{
   "errcode"  : 0,
   "errmsg"   : "ok",
   "trace_id" : "967e945cd8a3e458f3c74dcb886068e9"
}

An example of pushing asynchronous detection results

{
   "ToUserName"      : "gh_38cc49f9733b",
   "FromUserName"    : "oH1fu0FdHqpToe2T6gBj0WyB8iS1",
   "CreateTime"      : 1552465698,
   "MsgType"         : "event",
   "Event"           : "wxa_media_check",
   "isrisky"         : 0,
   "extra_info_json" : "",
   "appid"           : "wxd8c59133dfcbfc71",
   "trace_id"        : "967e945cd8a3e458f3c74dcb886068e9",
   "status_code"     : 0
}

If you encounter problems during the call, you can post an exchange in the Coral Safe Community.