addBlacklistPatterns

Use this method to add blacklist patterns.
Field
Type
Required
Description
method
String
Yes
"addBlacklistPatterns"
chat
Yes
Unique identifier for Group or Channel.
data
Array of Data
Yes
Add Array of patterns.

Requests

json
{ "method": "addBlacklistPatterns", "chat_id": "1448445521184549875648", "data": [ { "pattern": "558741", "example": "58441254" } ] }
java
ArrayList<Data> dataList = new ArrayList<>(); Data data = new Data(); data.setPattern("44444*"); data.setExample("44444444"); dataList.add(data); Data data2 = new Data(); data2.setPattern("222*"); data2.setExample("222222222"); dataList.add(data2); api.addBlacklistPatterns(incomingMsg.getChat().getId(), dataList); public void addBlacklistPatterns(String chatId, List<Data> data) { AddBlacklistPatternsOutMessage addBlacklistPatternsOutMessage = new AddBlacklistPatternsOutMessage(); addBlacklistPatternsOutMessage.setChatId(chatId); addBlacklistPatternsOutMessage.setData(data); api.send(addBlacklistPatternsOutMessage); }
javascript
let dataList = []; let data = new Data(); data.pattern = "44444*"; data.example = "44444444"; dataList.push(data); let data2 = new Data(); data2.pattern = "222*"; data2.example = "222222222"; dataList.push(data2); api.addBlackListPatterns(chat.id, dataList);

Response

json
{ "method": "blacklist", "blacklist": { "chat": { "id": "90090684293612221" }, "eop": "19", "users": [{ "id": "2", "signup_user": "201116601107" }, { "id": "4", "signup_user": "201116601109" }, { "id": "5", "signup_user": "201116601111" }, { "id": "14", "signup_user": "1111111" }, { "id": "15", "signup_user": "222222" }, { "id": "19", "signup_user": "222223" } ] } }