Use this method to add whitelist patterns, allowing only users who match a specific pattern (e.g.,
*@company.com
) to sign up for the app.Field | Type | Required | Description |
method | String | Yes | "addWhitelistPatterns" |
app_id | String | Yes | Unique identifier for App. |
patterns | Yes | An array of whitelist patterns to be added (e.g., ["@company.com", "+1*"] ). | |
reference | String | Optional | Unique identifier for the request. |
Preconditions for API Functionality
The following tables outline the preconditions that must be met for the API to function correctly. Failure to meet these conditions may result in errors or unexpected behavior.
- Preconditions for API permissions
Before performing signup management messages, ensure the following conditions are met:
Action | Required Permission | Description |
Signup Management | "Signup Management" | The API must have the "Signup Management" permission to manage both whitelist and blacklist settings. |
Response
addWhitelistPatterns_ack
β
On success, the
addWhiteListPatterns_ack
method is returned with an echo of the whitelist patterns
object.Field | Type | Returned | Description |
method | String | Yes | "addWhitelistPatterns_ack" |
app_id | String | Yes | Unique identifier for App. |
data | Yes | An array of whitelist patterns. | |
reference | String | Optional | Unique identifier echoed from the request. |
SDK Mapping β addWhitelistPatterns
SDK | Request Method | Response Callback |
Java | List<Data> users = new ArrayList<>();
Data data = new Data();
data.setPattern(".*@gmail.com");
data.setExample(" ss@gmail.com ");
users.add(data);
api.addWhitelistPatterns(chatId, users, appId, reference); | onWhiteListPattern(Pattern pattern) |
JavaScript | let data = new Data({ pattern: ".*@gmail.com", example: " ss@gmail.com " });
let dataList = [data];
api.addWhitelistPatterns(chatId, dataList, appId, reference); | onWhiteListPattern(pattern) |
Python | data = Data(dictionary={"pattern": ".*@gmail.com", "example": " ss@gmail.com "})
dataList = [data.to_dict()]
napi.add_white_list_patterns(chat_id=chat_id, data=dataList, app_id=app_id, reference=reference) | on_white_list_pattern(self, white_list_pattern) |
Example
Requests
json{ "method": "addWhitelistPatterns", "chat_id": "90090684293000559", "reference": 111111148, "app_id": "90090684293000559", "patterns": [ { "pattern": ".*@gmail.com", "tags": ["4"] } ] }
java{ List<Data> users = new ArrayList<>(); Data data = new Data(); data.setPattern(".*@gmail.com"); data.setExample("ss@gmail.com"); users.add(data); api.addWhitelistPatterns("90090684293000559", users, Long.valueOf("90090684293000559"), null); }
javascript{ let data = new Data({ pattern: ".*@gmail.com", example: "ss@gmail.com" }); let dataList = [data]; api.addWhitelistPatterns("90090684293000559", dataList, "90090684293000559", null); }
python{ data = Data(dictionary={"pattern": ".*@gmail.com", "example": "ss@gmail.com"}) dataList = [data.to_dict()] napi.add_white_list_patterns(chat_id="90090684293000559", data=dataList, app_id="90090684293000559", reference=None) }
Response
json{ "method": "addWhitelistPatterns_ack", "data": [ { "pattern": ".*@gmail.com", "id": "495", "tags": ["4"] } ], "app_id": "90090684293000559", "reference": 111111148 }