logo

addChatMember

Use this method to add a user as a member of a chat.

Field
Type
Required
Description
method
String
Yes
"addChatMember"
chat_id
Number
Yes
The chat to add the user to.
user_id
Number
Yes
The user to add.
app_id
String
Yes
Unique identifier for the App.
tags
Array of String
Optional
Tags to attach to the new member.
tester
Number
Optional
Marks the member 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 member
Admin in the chat
The API must be an administrator of the target chat with permission to manage members.

Response

chatMember

βœ… On success, a chatMember message is returned describing the added member.
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 β€” addChatMember

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

Example

Request

json
{ "method": "addChatMember", "chat_id": 90090684293000559, "user_id": 90091784056528980, "app_id": "90090684293000559" }

Powered by Notaku