Lifts a ban, removing the user from the chat's blacklist so they can join again.
Request
method is "unbanChatMember".
| Field |
Type |
Required |
Description |
chat_id |
String |
Yes |
The group or channel the ban applies to. |
user_id |
String |
Yes |
The banned user to reinstate. |
app_id |
String |
Yes |
The app the chat belongs to. |
reference |
String |
Optional |
Your id for this request. Echoed back in the response. |
Preconditions
| Requirement |
Why |
"Manage Chats" permission |
Needed to manage chats in the app. |
"Ban/unBan Chat Members" permission |
Needed specifically to ban and unban. |
| Moderator or admin in the chat |
Unbans require a privileged role in that chat. |
Response
chatMember
The member record comes back with "status": "Active" — they are off the blacklist.
| Field |
Type |
Returned |
Description |
method |
String |
Yes |
"chatMember" |
chatMember |
Chat Member |
Yes |
The member record, now showing "status": "Active". |
app_id |
String |
Yes |
Echoed from the request. |
reference |
String |
Optional |
Echoed from the request. |
SDKs
| SDK |
Call |
Callback |
| Java |
api.unbanChatMember(chatId, userId, appId, reference); |
onChatMember(ChatMember chatMember) |
| JavaScript |
api.unbanChatMember(chatId, userId, appId, reference); |
onChatMember(chatMember) |
| Python |
napi.unban_chat_member(chat_id=chat_id, user_id=user_id, app_id=app_id, reference=reference) |
on_chat_member(self, chat_member) |
Example
Request
{
"method": "unbanChatMember",
"chat_id": "90090684438172188",
"user_id": "90089584789572153",
"app_id": "90090684293000559",
"reference": "123456789"
}
api.unbanChatMember("90090684438172188", "90089584789572153", "90090684293000559", "123456789");
api.unbanChatMember("90090684438172188", "90089584789572153", "90090684293000559", "123456789");
napi.unban_chat_member(chat_id="90090684438172188", user_id="90089584789572153", app_id="90090684293000559", reference="123456789")
Response