logo

addChatAdmin

Use this method to add a user as an administrator of a chat.

Field
Type
Required
Description
method
String
Yes
"addChatAdmin"
chat_id
Number
Yes
The chat to add the administrator to.
user_id
Number
Yes
The user to promote.
app_id
String
Yes
Unique identifier for the App.
role
Number
Optional
The administrative role to assign.
tags
Array of String
Optional
Tags to attach to the administrator.
tester
Number
Optional
Marks the administrator as a tester.
ref
String
Optional
Correlation id, echoed in the response.

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.
Action
Required Permission
Description
Add a chat administrator
Admin in the chat
The API must be an administrator of the target chat with permission to manage administrators.

Response

chatMember

βœ… On success, a chatMember message is returned describing the promoted user.
Field
Type
Returned
Description
method
String
Yes
"chatMember"
chatMember
Object
Yes
The member record β€” includes the user, the chat, and the member type.
app_id
String
Yes
Unique identifier for the App.

SDK Mapping β€” addChatAdmin

SDK
Request Method
Response Callback
Java
api.addChatAdminMember(chatId, userId, appId);
onChatMember(ChatMember chatMember)
JavaScript
api.addChatAdminMember(chatId, userId, appId);
onChatMember(chatMember)
Python
napi.add_chat_admin_member(chat_id=chat_id, user_id=user_id, app_id=app_id)
on_chat_member(self, chat_member)

Example

Request

json
{ "method": "addChatAdmin", "chat_id": 90090684293000559, "user_id": 90091784056528980, "app_id": "90090684293000559", "role": 1 }

Powered by Notaku