Use this method to remove a chat member from the chat. Remove user is a temporary way of kicking the user out of a Group or Channel. The user will be able to join the chat once again.
Field | Type | Required | Description |
method | String | Yes | "removeChatMember" |
app_id | String | Yes | Unique identifier for App. |
chat_id | String | Yes | Unique identifier for chat Group or Channel where the member belongs. |
user_id | String | Yes | Unique identifier for this user member. |
reference | String | Optional | Unique identifier for the request. This reference will be echoed in the response. |
Preconditions for API Functionality
The following table outlines the preconditions that must be met for the API to function correctly. Failure to meet these conditions may result in errors or unexpected behavior.
Condition | Description |
API must have "Manage Chats" permission | The API needs "Manage Chats" permission to manage chats within the app. |
API must have "Remove Chat Members" permission | The API needs "Remove Chat Members" permission to ban and block members within chats. |
API must be a moderator or an admin in the chat | The API requires admin privileges in the chat to execute view or creation actions. |
Response:
chatMember
â
On success, the
chatMember
method is returned. The chatMember
object is returned with the status removed
. Removing a user is a temporary action to kick them out of a Group or Channel. The user will be able to join the chat again.Field | Type | Returned | Description |
method | String | Yes | "chatMember" |
app_id | String | Yes | Unique identifier for App. |
chatMember | Yes | chatMember Object of removed chat member. | |
reference | String | Optional | Unique identifier echoed from the request. |
Example:
Requests
json{ "method": "removeChatMember", "app_id": "90090684293000559", "chat_id": "90090684438172188", "user_id": "90089584789572153", "reference": "123456789" }
javaString chatId = "4522291356145774"; String userId = "90089584758972053"; api.removeChatMember(chatId, userId);
javascriptlet chatId = "4522291356145774"; let userId = "90089584758972053"; api.removeChatMember(chatId, userId);
pythonnapi.remove_chat_member("chatId", "userId")
Response
json{ "method": "chatMember", "app_id": "90090684293000559", "chatMember": { "view": null, "chat": { "id": "90090684438172188", }, "type": null, "user": { "id": "90089584789572153" }, "status": "Removed" }, "reference": "123456789", }