Adds whitelist patterns — rules such as .*@company.com that allow any matching identity to sign 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 "addWhitelistPatterns".
| 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 whitelist 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
addWhitelistPatterns_ack
| Field |
Type |
Returned |
Description |
method |
String |
Yes |
"addWhitelistPatterns_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.addWhitelistPatterns(chatId, patterns, appId, reference); |
onWhiteListPattern(Pattern pattern) |
| JavaScript |
api.addWhitelistPatterns(chatId, patterns, appId, reference); |
onWhiteListPattern(pattern) |
| Python |
napi.add_white_list_patterns(chat_id=chat_id, data=patterns, app_id=app_id, reference=reference) |
on_white_list_pattern(self, white_list_pattern) |
Example
Request
{
"method": "addWhitelistPatterns",
"chat_id": "90090684293000559",
"app_id": "90090684293000559",
"reference": 111111148,
"patterns": [
{
"pattern": ".*@gmail.com",
"tags": ["4"]
}
]
}
List<Data> patterns = new ArrayList<>();
Data data = new Data();
data.setPattern(".*@gmail.com");
data.setExample("[email protected]");
patterns.add(data);
api.addWhitelistPatterns("90090684293000559", patterns, "90090684293000559", "111111148");
let data = new Data({ pattern: ".*@gmail.com", example: "[email protected]" });
api.addWhitelistPatterns("90090684293000559", [data], "90090684293000559", "111111148");
data = Data(dictionary={"pattern": ".*@gmail.com", "example": "[email protected]"})
napi.add_white_list_patterns(
chat_id="90090684293000559",
data=[data.to_dict()],
app_id="90090684293000559",
reference="111111148",
)
Response