Use this method to add whitelist.
Field | Type | Required | Description |
method | String | Yes | "addWhitelist" |
chat | Yes | Unique identifier for Group or Channel. | |
users | Array of UsersWhiteListUser | Yes | Add an array of users. |
Requests
json{ "method": "addWhitelist", "users": [{ "signup_user": "54120001369", "tags": ["1", "2"] } ], "chat_id": "25554101368412978" }
javaArrayList<String> tagsList = new ArrayList<>(); tagsList.add("1"); tagsList.add("2"); ArrayList<WhiteListUser> whiteListUsersArray = new ArrayList<>(); WhiteListUser whiteListUser = new WhiteListUser(); whiteListUser.setSignupUser("16136147500"); whiteListUser.setTags(tagsList); whiteListUsersArray.add(whiteListUser); api.addWhiteList(incomingMsg.getChat().getId(), whiteListUsersArray); public void addWhiteList(String chatId, List<WhiteListUser> whiteListUsers) { AddWhiteListOutMessage addWhiteistOutMessage = new AddWhiteListOutMessage(); addWhiteistOutMessage.setChatId(chatId); addWhiteistOutMessage.setWhiteListUser(whiteListUsers); api.send(addWhiteistOutMessage); }
javascriptlet tagsList = []; tagsList.push("1"); tagsList.push("2"); let whiteListUsersArray = []; let whiteListUser = new WhiteListUser(); whiteListUser.signup_user = "16136147500"; whiteListUser.tags = tagsList; whiteListUsersArray.push(WhiteListUser); api.addWhiteList(incomingMsg.chat.id, whiteListUsersArray);
Response
json{ "method": "whitelist", "whitelist": { "chat": { "id": "90090684293612221" }, "eop": "13", "users": [{ "id": "645", "signup_user": "25648", "tags": ["1", "2"] } ] }