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.

1474940125966127.jpg

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

##

Return codeDescription
-1System busy
40003Incoming illegal openid
49003The incoming openid does not belong to this AppID

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

http请求方式:POST(请使用https协议)
https://api.weixin.qq.com/cgi-bin/tags/members/batchblacklist?access_token=ACCESS_TOKEN

Parameter Description

JSON data description

{
 "opened_list":["OPENID1”,” OPENID2”]
}

Return description

Return JSON data packet when correct

{
"errcode": 0,
"errmsg": "ok"
}

Return JSON data packet in case of error (example is invalid AppID error)

{"errcode":40013,"errmsg":"invalid appid"}

##Return code description

##

ParameterIs it requiredDescription
access_tokenYesCall 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.
Return codeDescription
-1System busy
40003Incoming illegal openid
49003The incoming openid does not belong to this AppID
40032Only 20 users can be blocked at a time


3. 取消拉黑用户

公众号可通过该接口来取消拉黑一批用户,黑名单列表由一串OpenID(加密后的微信号,每个用户对每个公众号的OpenID是唯一的)组成。

接口调用请求说明

http请求方式:POST(请使用https协议)
https://api.weixin.qq.com/cgi-bin/tags/members/batchunblacklist?access_token=ACCESS_TOKEN

Parameter Description

JSON data description

{
 "opened_list":["OPENID1”,” OPENID2”]
}

Return description

Return JSON data when correct Package

{
"errcode": 0,
"errmsg": "ok"
}

Returns JSON packet on error (example is Invalid AppID error )

{"errcode":40013,"errmsg":"invalid appid"}

Return code description

ParameterIs it requiredDescription
access_tokenYesCall 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.
Return codeDescription
-1System busy
40003Incoming illegal openid
49003The incoming openid does not belong to this AppID
40032Only 20 users can be blocked at a time
# #