Adds blacklist patterns β rules such as
.*@spam.com that block any matching identity from signing up, without listing each one individually.π‘ The request sends the rules underpatterns, but the acknowledgement returns them underdata. That asymmetry is intentional on the wire.
Request
method is "addBlacklistPatterns".Field | Type | Required | Description |
patterns | Yes | The rules to add. Each has a pattern, an optional example, and optional tags. | |
chat_id | String | Yes | The bot's chat id. |
app_id | String | Yes | The app the blacklist belongs to. |
reference | String | Optional | Your id for this request. Echoed back in the response. |
Preconditions
Requirement | Why |
"Signup Management" permission | Needed to manage whitelist and blacklist. |
Response
addBlacklistPatterns_ack
Field | Type | Returned | Description |
method | String | Yes | "addBlacklistPatterns_ack" |
data | Yes | The patterns now in effect, each with its assigned id. | |
app_id | String | Yes | Echoed from the request. |
reference | String | Optional | Echoed from the request. |
SDKs
SDK | Call | Callback |
Java | api.addBlacklistPatterns(chatId, patterns, appId, reference); | onBlackListPattern(Pattern blackListPattern) |
JavaScript | api.addBlacklistPatterns(chatId, patterns, appId, reference); | onBlackListPattern(pattern) |
Python | napi.add_black_list_patterns(chat_id=chat_id, data=patterns, app_id=app_id, reference=reference) | on_black_list_pattern(self, black_list_pattern) |
Example
Request
json{ "method": "addBlacklistPatterns", "chat_id": "90090684293000559", "app_id": "90090684293000559", "reference": 111111148, "patterns": [ { "pattern": ".*@gmail.com" } ] }
javaList<Data> patterns = new ArrayList<>(); Data data = new Data(); data.setPattern(".*@gmail.com"); data.setExample("ss@gmail.com"); patterns.add(data); api.addBlacklistPatterns("90090684293000559", patterns, "90090684293000559", "111111148");
javascriptlet data = new Data({ pattern: ".*@gmail.com", example: "ss@gmail.com" }); api.addBlacklistPatterns("90090684293000559", [data], "90090684293000559", "111111148");
pythondata = Data(dictionary={"pattern": ".*@gmail.com", "example": "ss@gmail.com"}) napi.add_black_list_patterns( chat_id="90090684293000559", data=[data.to_dict()], app_id="90090684293000559", reference="111111148", )
Response
json{ "method": "addBlacklistPatterns_ack", "app_id": "90090684293000559", "reference": "111111148", "data": [ { "id": "487", "pattern": ".*@gmail.com" } ] }