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 underpatterns, but the acknowledgement returns them underdata. That asymmetry is intentional on the wire.
Request
method is "addWhitelistPatterns".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 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 | 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
json{ "method": "addWhitelistPatterns", "chat_id": "90090684293000559", "app_id": "90090684293000559", "reference": 111111148, "patterns": [ { "pattern": ".*@gmail.com", "tags": ["4"] } ] }
javaList<Data> patterns = new ArrayList<>(); Data data = new Data(); data.setPattern(".*@gmail.com"); data.setExample("ss@gmail.com"); patterns.add(data); api.addWhitelistPatterns("90090684293000559", patterns, "90090684293000559", "111111148");
javascriptlet data = new Data({ pattern: ".*@gmail.com", example: "ss@gmail.com" }); api.addWhitelistPatterns("90090684293000559", [data], "90090684293000559", "111111148");
pythondata = Data(dictionary={"pattern": ".*@gmail.com", "example": "ss@gmail.com"}) napi.add_white_list_patterns( chat_id="90090684293000559", data=[data.to_dict()], app_id="90090684293000559", reference="111111148", )
Response
json{ "method": "addWhitelistPatterns_ack", "app_id": "90090684293000559", "reference": 111111148, "data": [ { "id": "495", "pattern": ".*@gmail.com", "tags": ["4"] } ] }