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 under patterns, but the acknowledgement returns them under data. That asymmetry is intentional on the wire.
Request
method is "addBlacklistPatterns".
| Field |
Type |
Required |
Description |
patterns |
Array of Pattern |
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 |
Array of Pattern |
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
{
"method": "addBlacklistPatterns",
"chat_id": "90090684293000559",
"app_id": "90090684293000559",
"reference": 111111148,
"patterns": [
{ "pattern": ".*@gmail.com" }
]
}
List<Data> patterns = new ArrayList<>();
Data data = new Data();
data.setPattern(".*@gmail.com");
data.setExample("[email protected]");
patterns.add(data);
api.addBlacklistPatterns("90090684293000559", patterns, "90090684293000559", "111111148");
let data = new Data({ pattern: ".*@gmail.com", example: "[email protected]" });
api.addBlacklistPatterns("90090684293000559", [data], "90090684293000559", "111111148");
data = Data(dictionary={"pattern": ".*@gmail.com", "example": "[email protected]"})
napi.add_black_list_patterns(
chat_id="90090684293000559",
data=[data.to_dict()],
app_id="90090684293000559",
reference="111111148",
)
Response