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

WeChat gadget msgSecCheck


May 19, 2021 WeChat Mini Program Development Document


Table of contents


security.msgSecCheck

This interface should be called on the server side, as detailed in the service side API.
This interface supports cloud calls. The developer tool version is required to be 1.02.1904090 (latest stable download), wx-server-sdk, and 0.4.0

Check that a piece of text contains illegal content.

Examples of scenarios:

  1. User's personal data violation text detection;
  2. Media news users publish articles, comments on content detection;
  3. Game users edit uploaded material (such as answers to questions and answers uploaded by small game users) detection. Frequency limit: A single appId call is capped at 4000 times per minute, 2,000,000 times per day, service market: more capabilities can be used through the service market, document details.

How to call:

  • HTTPS call
  • Cloud calls
  • Incremental call (enhanced version)

HTTPS call

The request address

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

Request parameters

Property Type The default Required Description
access_token string Is The interface calls the credentials
content string Is The text content to be detected is no longer than 500KB long

Returns a value

Object

The returned JSON packet

Property Type Description
errcode number Error code
errMsg string The error message

The legal value of errcode

Value Description The lowest version
0 The content is OK
87014 Content contains illegal and illegal content

The legal value of err Msg

Value Description The lowest version
"ok" The content is OK
"risky Content content contains illegal and illegal content

Call the example

curl -d '{ "content":"hello world!" }' 'https://api.weixin.qq.com/wxa/msg_sec_check?access_token=ACCESS_TOKEN'

Test case

特3456书yuuo莞6543李zxcz蒜7782法fgnv级
完2347全dfji试3726测asad感3847知qwez到

Developers can test with the above two paragraphs of text, and if the interface errcode returns 87014 (content contains illegal content), the docking is successful.

If you encounter problems during the call, you can post and communicate in the Coral Safe Community.

Cloud calls

Cloud calling is the ability provided by the small program Cloud Development to invoke WeChat's open interface in cloud functions and needs to be used in cloud functions via wx-server-sdk.

The interface method

openapi.security.msgSecCheck
Permissions for the security.msgSecCheck API need to be configured in config.json, details

Request parameters

Property Type The default Required Description
content string Is The text content to be detected is no longer than 500KB long

Returns a value

Object

The returned JSON packet

Property Type Description
errCode number Error code
errMsg string The error message

The legal value of errCode

Value Description The lowest version
0 Success

Abnormal

Object

The exception thrown

Property Type Description
errCode number Error code
errMsg string The error message

The legal value of errCode

Value Description The lowest version
87014 Content contains illegal and illegal content

The legal value of err Msg

Value Description The lowest version
"ok" The content is OK
"risky Content content contains illegal and illegal content