TelegramPHP Documentation

ChatApi

This file is generated from spec/openapi.json (Bot API 10.3) by tools/generate.php.

Do not edit it by hand - run composer spec:build instead.

Chats and the people in them: membership, administrators, permissions, invite links, forum topics, join requests, and chat appearance.

Mixed into Telegram through Methods. Every method is named exactly as the Bot API names it, takes exactly the fields the Bot API documents (use named arguments for the optional ones), and resolves with the hydrated result.

Tags
link
https://core.telegram.org/bots/api
since

v10.3

Table of Contents

Methods

answerChatJoinRequestQuery()  : PromiseInterface<string|int, bool>
Use this method to process a received chat join request query. Returns True on success.
approveChatJoinRequest()  : PromiseInterface<string|int, bool>
Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
approveSuggestedPost()  : PromiseInterface<string|int, bool>
Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success.
banChatMember()  : PromiseInterface<string|int, bool>
Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
banChatSenderChat()  : PromiseInterface<string|int, bool>
Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels.
closeForumTopic()  : PromiseInterface<string|int, bool>
Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
closeGeneralForumTopic()  : PromiseInterface<string|int, bool>
Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
createChatInviteLink()  : PromiseInterface<string|int, ChatInviteLink>
Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object.
createChatSubscriptionInviteLink()  : PromiseInterface<string|int, ChatInviteLink>
Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.
createForumTopic()  : PromiseInterface<string|int, ForumTopic>
Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object.
declineChatJoinRequest()  : PromiseInterface<string|int, bool>
Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
declineSuggestedPost()  : PromiseInterface<string|int, bool>
Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success.
deleteChatPhoto()  : PromiseInterface<string|int, bool>
Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
deleteForumTopic()  : PromiseInterface<string|int, bool>
Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success.
editChatInviteLink()  : PromiseInterface<string|int, ChatInviteLink>
Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
editChatSubscriptionInviteLink()  : PromiseInterface<string|int, ChatInviteLink>
Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.
editForumTopic()  : PromiseInterface<string|int, bool>
Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
editGeneralForumTopic()  : PromiseInterface<string|int, bool>
Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
exportChatInviteLink()  : PromiseInterface<string|int, string>
Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.
getChat()  : PromiseInterface<string|int, ChatFullInfo>
Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success.
getChatAdministrators()  : PromiseInterface<string|int, Collection<string|int, ChatMember>>
Use this method to get a list of administrators in a chat. Returns an Array of ChatMember objects.
getChatMember()  : PromiseInterface<string|int, ChatMember>
Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success.
getChatMemberCount()  : PromiseInterface<string|int, int>
Use this method to get the number of members in a chat. Returns Integer on success.
getUserChatBoosts()  : PromiseInterface<string|int, UserChatBoosts>
Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.
getUserPersonalChatMessages()  : PromiseInterface<string|int, Collection<string|int, Message>>
Use this method to get the last messages from the personal chat (i.e., the chat currently added to their profile) of a given user. On success, an Array of Message objects is returned.
getUserProfileAudios()  : PromiseInterface<string|int, UserProfileAudios>
Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.
getUserProfilePhotos()  : PromiseInterface<string|int, UserProfilePhotos>
Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
hideGeneralForumTopic()  : PromiseInterface<string|int, bool>
Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.
leaveChat()  : PromiseInterface<string|int, bool>
Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
promoteChatMember()  : PromiseInterface<string|int, bool>
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
removeChatVerification()  : PromiseInterface<string|int, bool>
Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.
removeUserVerification()  : PromiseInterface<string|int, bool>
Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.
reopenForumTopic()  : PromiseInterface<string|int, bool>
Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.
reopenGeneralForumTopic()  : PromiseInterface<string|int, bool>
Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.
restrictChatMember()  : PromiseInterface<string|int, bool>
Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.
revokeChatInviteLink()  : PromiseInterface<string|int, ChatInviteLink>
Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object.
setChatAdministratorCustomTitle()  : PromiseInterface<string|int, bool>
Use this method to set a custom title for an administrator in a supergroup promoted by the bot.
setChatDescription()  : PromiseInterface<string|int, bool>
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
setChatMemberTag()  : PromiseInterface<string|int, bool>
Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the can_manage_tags administrator right. Returns True on success.
setChatPermissions()  : PromiseInterface<string|int, bool>
Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.
setChatPhoto()  : PromiseInterface<string|int, bool>
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
setChatTitle()  : PromiseInterface<string|int, bool>
Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
setUserEmojiStatus()  : PromiseInterface<string|int, bool>
Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
unbanChatMember()  : PromiseInterface<string|int, bool>
Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success.
unbanChatSenderChat()  : PromiseInterface<string|int, bool>
Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights.
unhideGeneralForumTopic()  : PromiseInterface<string|int, bool>
Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
unpinAllForumTopicMessages()  : PromiseInterface<string|int, bool>
Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
unpinAllGeneralForumTopicMessages()  : PromiseInterface<string|int, bool>
Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
verifyChat()  : PromiseInterface<string|int, bool>
Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.
verifyUser()  : PromiseInterface<string|int, bool>
Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.

Methods

answerChatJoinRequestQuery()

Use this method to process a received chat join request query. Returns True on success.

public answerChatJoinRequestQuery(string $chat_join_request_query_id, string $result) : PromiseInterface<string|int, bool>
Parameters
$chat_join_request_query_id : string

Unique identifier of the join request query

$result : string

Result of the query. Must be either "approve" to allow the user to join the chat, "decline" to disallow the user to join the chat, or "queue" to leave the decision to other administrators.

Tags
link
https://core.telegram.org/bots/api#answerchatjoinrequestquery
Return values
PromiseInterface<string|int, bool>

approveChatJoinRequest()

Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.

public approveChatJoinRequest(int|string $chat_id, int $user_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$user_id : int

Unique identifier of the target user

Tags
link
https://core.telegram.org/bots/api#approvechatjoinrequest
Return values
PromiseInterface<string|int, bool>

approveSuggestedPost()

Use this method to approve a suggested post in a direct messages chat. The bot must have the 'can_post_messages' administrator right in the corresponding channel chat. Returns True on success.

public approveSuggestedPost(int $chat_id, int $message_id[, int|null $send_date = null ]) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int

Unique identifier for the target direct messages chat

$message_id : int

Identifier of a suggested post message to approve

$send_date : int|null = null

Optional. Point in time (Unix timestamp) when the post is expected to be published; omit if the date has already been specified when the suggested post was created. If specified, then the date must be not more than 2678400 seconds (30 days) in the future.

Tags
link
https://core.telegram.org/bots/api#approvesuggestedpost
Return values
PromiseInterface<string|int, bool>

banChatMember()

Use this method to ban a user in a group, a supergroup or a channel. In the case of supergroups and channels, the user will not be able to return to the chat on their own using invite links, etc., unless unbanned first. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

public banChatMember(int|string $chat_id, int $user_id[, int|null $until_date = null ][, bool|null $revoke_messages = null ]) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target group or username of the target supergroup or channel in the format @username

$user_id : int

Unique identifier of the target user

$until_date : int|null = null

Optional. Date when the user will be unbanned; Unix time. If user is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever. Applied for supergroups and channels only.

$revoke_messages : bool|null = null

Optional. Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed. Always True for supergroups and channels.

Tags
link
https://core.telegram.org/bots/api#banchatmember
Return values
PromiseInterface<string|int, bool>

banChatSenderChat()

Use this method to ban a channel chat in a supergroup or a channel. Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels.

public banChatSenderChat(int|string $chat_id, int $sender_chat_id) : PromiseInterface<string|int, bool>

The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns True on success.

Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$sender_chat_id : int

Unique identifier of the target sender chat

Tags
link
https://core.telegram.org/bots/api#banchatsenderchat
Return values
PromiseInterface<string|int, bool>

closeForumTopic()

Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

public closeForumTopic(int|string $chat_id, int $message_thread_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$message_thread_id : int

Unique identifier for the target message thread of the forum topic

Tags
link
https://core.telegram.org/bots/api#closeforumtopic
Return values
PromiseInterface<string|int, bool>

closeGeneralForumTopic()

Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.

public closeGeneralForumTopic(int|string $chat_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

Tags
link
https://core.telegram.org/bots/api#closegeneralforumtopic
Return values
PromiseInterface<string|int, bool>

Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. The link can be revoked using the method revokeChatInviteLink. Returns the new invite link as ChatInviteLink object.

public createChatInviteLink(int|string $chat_id[, string|null $name = null ][, int|null $expire_date = null ][, int|null $member_limit = null ][, bool|null $creates_join_request = null ]) : PromiseInterface<string|int, ChatInviteLink>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$name : string|null = null

Optional. Invite link name; 0-32 characters

$expire_date : int|null = null

Optional. Point in time (Unix timestamp) when the link will expire

$member_limit : int|null = null

Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999

$creates_join_request : bool|null = null

Optional. True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified.

link
https://core.telegram.org/bots/api#createchatinvitelink
Return values
PromiseInterface<string|int, ChatInviteLink>

Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator rights. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.

public createChatSubscriptionInviteLink(int|string $chat_id, int $subscription_period, int $subscription_price[, string|null $name = null ]) : PromiseInterface<string|int, ChatInviteLink>
Parameters
$chat_id : int|string

Unique identifier for the target channel chat or username of the target channel in the format @username

$subscription_period : int

The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).

$subscription_price : int

The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000

$name : string|null = null

Optional. Invite link name; 0-32 characters

link
https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
Return values
PromiseInterface<string|int, ChatInviteLink>

createForumTopic()

Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns information about the created topic as a ForumTopic object.

public createForumTopic(int|string $chat_id, string $name[, int|null $icon_color = null ][, string|null $icon_custom_emoji_id = null ]) : PromiseInterface<string|int, ForumTopic>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$name : string

Topic name, 1-128 characters

$icon_color : int|null = null

Optional. Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F).

$icon_custom_emoji_id : string|null = null

Optional. Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers.

Tags
link
https://core.telegram.org/bots/api#createforumtopic
Return values
PromiseInterface<string|int, ForumTopic>

declineChatJoinRequest()

Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.

public declineChatJoinRequest(int|string $chat_id, int $user_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$user_id : int

Unique identifier of the target user

Tags
link
https://core.telegram.org/bots/api#declinechatjoinrequest
Return values
PromiseInterface<string|int, bool>

declineSuggestedPost()

Use this method to decline a suggested post in a direct messages chat. The bot must have the 'can_manage_direct_messages' administrator right in the corresponding channel chat. Returns True on success.

public declineSuggestedPost(int $chat_id, int $message_id[, string|null $comment = null ]) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int

Unique identifier for the target direct messages chat

$message_id : int

Identifier of a suggested post message to decline

$comment : string|null = null

Optional. Comment for the creator of the suggested post; 0-128 characters

Tags
link
https://core.telegram.org/bots/api#declinesuggestedpost
Return values
PromiseInterface<string|int, bool>

deleteChatPhoto()

Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

public deleteChatPhoto(int|string $chat_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

Tags
link
https://core.telegram.org/bots/api#deletechatphoto
Return values
PromiseInterface<string|int, bool>

deleteForumTopic()

Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator rights. Returns True on success.

public deleteForumTopic(int|string $chat_id, int $message_thread_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$message_thread_id : int

Unique identifier for the target message thread of the forum topic

Tags
link
https://core.telegram.org/bots/api#deleteforumtopic
Return values
PromiseInterface<string|int, bool>

Use this method to edit a non-primary invite link created by the bot. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.

public editChatInviteLink(int|string $chat_id, string $invite_link[, string|null $name = null ][, int|null $expire_date = null ][, int|null $member_limit = null ][, bool|null $creates_join_request = null ]) : PromiseInterface<string|int, ChatInviteLink>

Returns the edited invite link as a ChatInviteLink object.

Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$invite_link : string

The invite link to edit

$name : string|null = null

Optional. Invite link name; 0-32 characters

$expire_date : int|null = null

Optional. Point in time (Unix timestamp) when the link will expire

$member_limit : int|null = null

Optional. The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999

$creates_join_request : bool|null = null

Optional. True, if users joining the chat via the link need to be approved by chat administrators. If True, member_limit can't be specified.

link
https://core.telegram.org/bots/api#editchatinvitelink
Return values
PromiseInterface<string|int, ChatInviteLink>

Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator rights. Returns the edited invite link as a ChatInviteLink object.

public editChatSubscriptionInviteLink(int|string $chat_id, string $invite_link[, string|null $name = null ]) : PromiseInterface<string|int, ChatInviteLink>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$invite_link : string

The invite link to edit

$name : string|null = null

Optional. Invite link name; 0-32 characters

link
https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
Return values
PromiseInterface<string|int, ChatInviteLink>

editForumTopic()

Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

public editForumTopic(int|string $chat_id, int $message_thread_id[, string|null $name = null ][, string|null $icon_custom_emoji_id = null ]) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$message_thread_id : int

Unique identifier for the target message thread of the forum topic

$name : string|null = null

Optional. New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept.

$icon_custom_emoji_id : string|null = null

Optional. New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept.

Tags
link
https://core.telegram.org/bots/api#editforumtopic
Return values
PromiseInterface<string|int, bool>

editGeneralForumTopic()

Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.

public editGeneralForumTopic(int|string $chat_id, string $name) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$name : string

New topic name, 1-128 characters

Tags
link
https://core.telegram.org/bots/api#editgeneralforumtopic
Return values
PromiseInterface<string|int, bool>

Use this method to generate a new primary invite link for a chat; any previously generated primary link is revoked. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the new invite link as String on success.

public exportChatInviteLink(int|string $chat_id) : PromiseInterface<string|int, string>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

link
https://core.telegram.org/bots/api#exportchatinvitelink
Return values
PromiseInterface<string|int, string>

getChat()

Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success.

public getChat(int|string $chat_id) : PromiseInterface<string|int, ChatFullInfo>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup or channel in the format @username

Tags
link
https://core.telegram.org/bots/api#getchat
Return values
PromiseInterface<string|int, ChatFullInfo>

getChatAdministrators()

Use this method to get a list of administrators in a chat. Returns an Array of ChatMember objects.

public getChatAdministrators(int|string $chat_id[, bool|null $return_bots = null ]) : PromiseInterface<string|int, Collection<string|int, ChatMember>>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup or channel in the format @username

$return_bots : bool|null = null

Optional. Pass True to additionally receive all bots that are administrators of the chat. By default, bots other than the current bot are omitted.

Tags
link
https://core.telegram.org/bots/api#getchatadministrators
Return values
PromiseInterface<string|int, Collection<string|int, ChatMember>>

getChatMember()

Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success.

public getChatMember(int|string $chat_id, int $user_id) : PromiseInterface<string|int, ChatMember>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup or channel in the format @username

$user_id : int

Unique identifier of the target user

Tags
link
https://core.telegram.org/bots/api#getchatmember
Return values
PromiseInterface<string|int, ChatMember>

getChatMemberCount()

Use this method to get the number of members in a chat. Returns Integer on success.

public getChatMemberCount(int|string $chat_id) : PromiseInterface<string|int, int>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup or channel in the format @username

Tags
link
https://core.telegram.org/bots/api#getchatmembercount
Return values
PromiseInterface<string|int, int>

getUserChatBoosts()

Use this method to get the list of boosts added to a chat by a user. Requires administrator rights in the chat. Returns a UserChatBoosts object.

public getUserChatBoosts(int|string $chat_id, int $user_id) : PromiseInterface<string|int, UserChatBoosts>
Parameters
$chat_id : int|string

Unique identifier for the chat or username of the channel in the format @username

$user_id : int

Unique identifier of the target user

Tags
link
https://core.telegram.org/bots/api#getuserchatboosts
Return values
PromiseInterface<string|int, UserChatBoosts>

getUserPersonalChatMessages()

Use this method to get the last messages from the personal chat (i.e., the chat currently added to their profile) of a given user. On success, an Array of Message objects is returned.

public getUserPersonalChatMessages(int $user_id, int $limit) : PromiseInterface<string|int, Collection<string|int, Message>>
Parameters
$user_id : int

Unique identifier for the target user

$limit : int

The maximum number of messages to return; 1-20

Tags
link
https://core.telegram.org/bots/api#getuserpersonalchatmessages
Return values
PromiseInterface<string|int, Collection<string|int, Message>>

getUserProfileAudios()

Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.

public getUserProfileAudios(int $user_id[, int|null $offset = null ][, int|null $limit = null ]) : PromiseInterface<string|int, UserProfileAudios>
Parameters
$user_id : int

Unique identifier of the target user

$offset : int|null = null

Optional. Sequential number of the first audio to be returned. By default, all audios are returned.

$limit : int|null = null

Optional. Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100.

Tags
link
https://core.telegram.org/bots/api#getuserprofileaudios
Return values
PromiseInterface<string|int, UserProfileAudios>

getUserProfilePhotos()

Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.

public getUserProfilePhotos(int $user_id[, int|null $offset = null ][, int|null $limit = null ]) : PromiseInterface<string|int, UserProfilePhotos>
Parameters
$user_id : int

Unique identifier of the target user

$offset : int|null = null

Optional. Sequential number of the first photo to be returned. By default, all photos are returned.

$limit : int|null = null

Optional. Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults to 100.

Tags
link
https://core.telegram.org/bots/api#getuserprofilephotos
Return values
PromiseInterface<string|int, UserProfilePhotos>

hideGeneralForumTopic()

Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically closed if it was open. Returns True on success.

public hideGeneralForumTopic(int|string $chat_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

Tags
link
https://core.telegram.org/bots/api#hidegeneralforumtopic
Return values
PromiseInterface<string|int, bool>

leaveChat()

Use this method for your bot to leave a group, supergroup or channel. Returns True on success.

public leaveChat(int|string $chat_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup or channel in the format @username. Channel direct messages chats aren't supported; leave the corresponding channel instead.

Tags
link
https://core.telegram.org/bots/api#leavechat
Return values
PromiseInterface<string|int, bool>

promoteChatMember()

Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.

public promoteChatMember(int|string $chat_id, int $user_id[, bool|null $is_anonymous = null ][, bool|null $can_manage_chat = null ][, bool|null $can_delete_messages = null ][, bool|null $can_manage_video_chats = null ][, bool|null $can_restrict_members = null ][, bool|null $can_promote_members = null ][, bool|null $can_change_info = null ][, bool|null $can_invite_users = null ][, bool|null $can_post_stories = null ][, bool|null $can_edit_stories = null ][, bool|null $can_delete_stories = null ][, bool|null $can_post_messages = null ][, bool|null $can_edit_messages = null ][, bool|null $can_pin_messages = null ][, bool|null $can_manage_topics = null ][, bool|null $can_manage_direct_messages = null ][, bool|null $can_manage_tags = null ][, bool|null $can_send_welcome_messages = null ]) : PromiseInterface<string|int, bool>

Pass False for all boolean parameters to demote a user. Returns True on success.

Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$user_id : int

Unique identifier of the target user

$is_anonymous : bool|null = null

Optional. Pass True if the administrator's presence in the chat is hidden

$can_manage_chat : bool|null = null

Optional. Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other administrator privilege.

$can_delete_messages : bool|null = null

Optional. Pass True if the administrator can delete messages of other users

$can_manage_video_chats : bool|null = null

Optional. Pass True if the administrator can manage video chats

$can_restrict_members : bool|null = null

Optional. Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics. For backward compatibility, defaults to True for promotions of channel administrators.

$can_promote_members : bool|null = null

Optional. Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him)

$can_change_info : bool|null = null

Optional. Pass True if the administrator can change chat title, photo and other settings

$can_invite_users : bool|null = null

Optional. Pass True if the administrator can invite new users to the chat

$can_post_stories : bool|null = null

Optional. Pass True if the administrator can post stories to the chat

$can_edit_stories : bool|null = null

Optional. Pass True if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access the chat's story archive

$can_delete_stories : bool|null = null

Optional. Pass True if the administrator can delete stories posted by other users

$can_post_messages : bool|null = null

Optional. Pass True if the administrator can post messages in the channel, approve suggested posts, or access channel statistics; for channels only

$can_edit_messages : bool|null = null

Optional. Pass True if the administrator can edit messages of other users and can pin messages; for channels only

$can_pin_messages : bool|null = null

Optional. Pass True if the administrator can pin messages; for supergroups only

$can_manage_topics : bool|null = null

Optional. Pass True if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only

$can_manage_direct_messages : bool|null = null

Optional. Pass True if the administrator can manage direct messages within the channel and decline suggested posts; for channels only

$can_manage_tags : bool|null = null

Optional. Pass True if the administrator can edit the tags of regular members; for groups and supergroups only

$can_send_welcome_messages : bool|null = null

Optional. Pass True if the administrator can manage chat welcome messages or directly send them in the case of bots

Tags
link
https://core.telegram.org/bots/api#promotechatmember
Return values
PromiseInterface<string|int, bool>

removeChatVerification()

Removes verification from a chat that is currently verified on behalf of the organization represented by the bot. Returns True on success.

public removeChatVerification(int|string $chat_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target bot or channel in the format @username

Tags
link
https://core.telegram.org/bots/api#removechatverification
Return values
PromiseInterface<string|int, bool>

removeUserVerification()

Removes verification from a user who is currently verified on behalf of the organization represented by the bot. Returns True on success.

public removeUserVerification(int $user_id) : PromiseInterface<string|int, bool>
Parameters
$user_id : int

Unique identifier of the target user

Tags
link
https://core.telegram.org/bots/api#removeuserverification
Return values
PromiseInterface<string|int, bool>

reopenForumTopic()

Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights, unless it is the creator of the topic. Returns True on success.

public reopenForumTopic(int|string $chat_id, int $message_thread_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$message_thread_id : int

Unique identifier for the target message thread of the forum topic

Tags
link
https://core.telegram.org/bots/api#reopenforumtopic
Return values
PromiseInterface<string|int, bool>

reopenGeneralForumTopic()

Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. The topic will be automatically unhidden if it was hidden. Returns True on success.

public reopenGeneralForumTopic(int|string $chat_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

Tags
link
https://core.telegram.org/bots/api#reopengeneralforumtopic
Return values
PromiseInterface<string|int, bool>

restrictChatMember()

Use this method to restrict a user in a supergroup. The bot must be an administrator in the supergroup for this to work and must have the appropriate administrator rights. Pass True for all permissions to lift restrictions from a user. Returns True on success.

public restrictChatMember(int|string $chat_id, int $user_id, ChatPermissions|array<string|int, mixed> $permissions[, bool|null $use_independent_chat_permissions = null ][, int|null $until_date = null ]) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$user_id : int

Unique identifier of the target user

$permissions : ChatPermissions|array<string|int, mixed>

A JSON-serialized object for new user permissions

$use_independent_chat_permissions : bool|null = null

Optional. Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.

$until_date : int|null = null

Optional. Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever.

Tags
link
https://core.telegram.org/bots/api#restrictchatmember
Return values
PromiseInterface<string|int, bool>

Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as ChatInviteLink object.

public revokeChatInviteLink(int|string $chat_id, string $invite_link) : PromiseInterface<string|int, ChatInviteLink>
Parameters
$chat_id : int|string

Unique identifier of the target chat or username of the target channel in the format @username

$invite_link : string

The invite link to revoke

link
https://core.telegram.org/bots/api#revokechatinvitelink
Return values
PromiseInterface<string|int, ChatInviteLink>

setChatAdministratorCustomTitle()

Use this method to set a custom title for an administrator in a supergroup promoted by the bot.

public setChatAdministratorCustomTitle(int|string $chat_id, int $user_id, string $custom_title) : PromiseInterface<string|int, bool>

Returns True on success.

Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$user_id : int

Unique identifier of the target user

$custom_title : string

New custom title for the administrator; 0-16 characters, emoji are not allowed

Tags
link
https://core.telegram.org/bots/api#setchatadministratorcustomtitle
Return values
PromiseInterface<string|int, bool>

setChatDescription()

Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

public setChatDescription(int|string $chat_id[, string|null $description = null ]) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$description : string|null = null

Optional. New chat description, 0-255 characters

Tags
link
https://core.telegram.org/bots/api#setchatdescription
Return values
PromiseInterface<string|int, bool>

setChatMemberTag()

Use this method to set a tag for a regular member in a group or a supergroup. The bot must be an administrator in the chat for this to work and must have the can_manage_tags administrator right. Returns True on success.

public setChatMemberTag(int|string $chat_id, int $user_id[, string|null $tag = null ]) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$user_id : int

Unique identifier of the target user

$tag : string|null = null

Optional. New tag for the member; 0-16 characters, emoji are not allowed

Tags
link
https://core.telegram.org/bots/api#setchatmembertag
Return values
PromiseInterface<string|int, bool>

setChatPermissions()

Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members administrator rights. Returns True on success.

public setChatPermissions(int|string $chat_id, ChatPermissions|array<string|int, mixed> $permissions[, bool|null $use_independent_chat_permissions = null ]) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$permissions : ChatPermissions|array<string|int, mixed>

A JSON-serialized object for new default chat permissions

$use_independent_chat_permissions : bool|null = null

Optional. Pass True if chat permissions are set independently. Otherwise, the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages, can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages permission.

Tags
link
https://core.telegram.org/bots/api#setchatpermissions
Return values
PromiseInterface<string|int, bool>

setChatPhoto()

Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

public setChatPhoto(int|string $chat_id, InputFile $photo) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$photo : InputFile

New chat photo, uploaded using multipart/form-data

Tags
link
https://core.telegram.org/bots/api#setchatphoto
Return values
PromiseInterface<string|int, bool>

setChatTitle()

Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.

public setChatTitle(int|string $chat_id, string $title) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$title : string

New chat title, 1-128 characters

Tags
link
https://core.telegram.org/bots/api#setchattitle
Return values
PromiseInterface<string|int, bool>

setUserEmojiStatus()

Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.

public setUserEmojiStatus(int $user_id[, string|null $emoji_status_custom_emoji_id = null ][, int|null $emoji_status_expiration_date = null ]) : PromiseInterface<string|int, bool>
Parameters
$user_id : int

Unique identifier of the target user

$emoji_status_custom_emoji_id : string|null = null

Optional. Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.

$emoji_status_expiration_date : int|null = null

Optional. Expiration date of the emoji status, if any

Tags
link
https://core.telegram.org/bots/api#setuseremojistatus
Return values
PromiseInterface<string|int, bool>

unbanChatMember()

Use this method to unban a previously banned user in a supergroup or channel. The user will not return to the group or channel automatically, but will be able to join via link, etc. The bot must be an administrator for this to work. By default, this method guarantees that after the call the user is not a member of the chat, but will be able to join it. So if the user is a member of the chat they will also be removed from the chat. If you don't want this, use the parameter only_if_banned. Returns True on success.

public unbanChatMember(int|string $chat_id, int $user_id[, bool|null $only_if_banned = null ]) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target group or username of the target supergroup or channel in the format @username

$user_id : int

Unique identifier of the target user

$only_if_banned : bool|null = null

Optional. Do nothing if the user is not banned

Tags
link
https://core.telegram.org/bots/api#unbanchatmember
Return values
PromiseInterface<string|int, bool>

unbanChatSenderChat()

Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights.

public unbanChatSenderChat(int|string $chat_id, int $sender_chat_id) : PromiseInterface<string|int, bool>

Returns True on success.

Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target channel in the format @username

$sender_chat_id : int

Unique identifier of the target sender chat

Tags
link
https://core.telegram.org/bots/api#unbanchatsenderchat
Return values
PromiseInterface<string|int, bool>

unhideGeneralForumTopic()

Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.

public unhideGeneralForumTopic(int|string $chat_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

Tags
link
https://core.telegram.org/bots/api#unhidegeneralforumtopic
Return values
PromiseInterface<string|int, bool>

unpinAllForumTopicMessages()

Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.

public unpinAllForumTopicMessages(int|string $chat_id, int $message_thread_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

$message_thread_id : int

Unique identifier for the target message thread of the forum topic

Tags
link
https://core.telegram.org/bots/api#unpinallforumtopicmessages
Return values
PromiseInterface<string|int, bool>

unpinAllGeneralForumTopicMessages()

Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.

public unpinAllGeneralForumTopicMessages(int|string $chat_id) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target supergroup in the format @username

Tags
link
https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
Return values
PromiseInterface<string|int, bool>

verifyChat()

Verifies a chat on behalf of the organization which is represented by the bot. Returns True on success.

public verifyChat(int|string $chat_id[, string|null $custom_description = null ]) : PromiseInterface<string|int, bool>
Parameters
$chat_id : int|string

Unique identifier for the target chat or username of the target bot, supergroup or channel in the format @username. Channel direct messages chats can't be verified.

$custom_description : string|null = null

Optional. Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.

Tags
link
https://core.telegram.org/bots/api#verifychat
Return values
PromiseInterface<string|int, bool>

verifyUser()

Verifies a user on behalf of the organization which is represented by the bot. Returns True on success.

public verifyUser(int $user_id[, string|null $custom_description = null ]) : PromiseInterface<string|int, bool>
Parameters
$user_id : int

Unique identifier of the target user

$custom_description : string|null = null

Optional. Custom description for the verification; 0-70 characters. Must be empty if the organization isn't allowed to provide a custom verification description.

Tags
link
https://core.telegram.org/bots/api#verifyuser
Return values
PromiseInterface<string|int, bool>
On this page

Search results