Blacklist management
Blacklist Management
Official accounts can log in to the WeChat public platform to block fans. At the same time, we also provide a set of blacklist management API so that developers can directly use the interface to operate.
1. Get the blacklist list of public accounts
Official accounts can obtain the account's blacklist through this interface. The blacklist consists of a string of OpenIDs (encrypted WeChat IDs, each user's OpenID for each official account is unique) .
This interface can pull up to 10,000 OpenIDs per call. When the number of lists is large, multiple pulls can be used to meet the needs.
Interface call request description
http请求方式:POST(请使用https协议) https://api.weixin.qq.com/cgi-bin/tags/members/getblacklist?access_token=ACCESS_TOKEN
JSON data description
{ "begin_openid":"OPENID1" }
When begin_openid is empty, it will be pulled from the beginning by default.
Return description
Return JSON data packet when correct
{ "total":23000, "count":10000, "data":{" openid":[ "OPENID1", "OPENID2", ..., "OPENID10000" ] }, "next_openid":"OPENID10000" }
Return JSON packet on error (example is invalid AppID error)
{"errcode":40013,"errmsg":"invalid appid"}
##Return code description
## At the same time, please note: When the number of public account blacklists exceeds 10,000, you can pull the list multiple times by filling in the value of next_openid ways to meet needs. Specifically, when calling the interface, the next_openid value returned in the previous call is used as the next_openid value in the next call. 2. Block the user public account through this interface To blacklist a group of users, the blacklist list consists of a string of OpenIDs (encrypted WeChat IDs, each user's OpenID for each public account is unique). Interface call request description Parameter Description JSON data description Return description Return JSON data packet when correct Return JSON data packet in case of error (example is invalid AppID error) ##Return code description ## 3. 取消拉黑用户 公众号可通过该接口来取消拉黑一批用户,黑名单列表由一串OpenID(加密后的微信号,每个用户对每个公众号的OpenID是唯一的)组成。 接口调用请求说明 Parameter Description JSON data description Return description Return JSON data when correct Package Returns JSON packet on error (example is Invalid AppID error ) Return code descriptionReturn code Description -1 System busy 40003 Incoming illegal openid 49003 The incoming openid does not belong to this AppID http请求方式:POST(请使用https协议)
https://api.weixin.qq.com/cgi-bin/tags/members/batchblacklist?access_token=ACCESS_TOKEN
Parameter Is it required Description access_token Yes Call interface credentials openid_list is the openid of the user who needs to be blacklisted. A maximum of 20 users are allowed to be blacklisted at one time. {
"opened_list":["OPENID1”,” OPENID2”]
}
{
"errcode": 0,
"errmsg": "ok"
}
{"errcode":40013,"errmsg":"invalid appid"}
Return code Description -1 System busy 40003 Incoming illegal openid 49003 The incoming openid does not belong to this AppID 40032 Only 20 users can be blocked at a time http请求方式:POST(请使用https协议)
https://api.weixin.qq.com/cgi-bin/tags/members/batchunblacklist?access_token=ACCESS_TOKEN
Parameter Is it required Description access_token Yes Call interface credentials openid_list is the openid of the user who needs to be blacklisted. A maximum of 20 users are allowed to be blacklisted at one time. {
"opened_list":["OPENID1”,” OPENID2”]
}
{
"errcode": 0,
"errmsg": "ok"
}
{"errcode":40013,"errmsg":"invalid appid"}
# #Return code Description -1 System busy 40003 Incoming illegal openid 49003 The incoming openid does not belong to this AppID 40032 Only 20 users can be blocked at a time