This page is about Pyrogram methods. All the methods listed here are bound to a Client instance, except for idle() and compose(), which are special functions that can be found in the main package directly.

from pyrogram import Client

app = Client("my_account")

with app:
    app.send_message(chat_id="me", text="hi")

Utilities#

idle

Block the main script execution until a signal is received.

compose

Run multiple clients at once.

Authorization#

Messages#

send_message

Send text messages.

forward_messages

Forward messages of any kind.

copy_message

Copy messages of any kind.

send_photo

Send photos.

send_audio

Send audio files.

send_document

Send generic files.

send_video

Send video files.

send_animation

Send animation files (animation or H.264/MPEG-4 AVC video without sound).

send_voice

Send audio files.

send_video_note

Send video messages.

send_cached_media

Send any media stored on the Telegram servers using a file_id.

send_paid_media

Use this method to send paid media.

send_media_group

Use this method to send a group of photos, videos, documents or audios as an album.

get_media_group

Get the media group a message belongs to.

copy_media_group

Copy a media group by providing one of the message ids.

send_location

Send points on the map.

send_venue

Send information about a venue.

send_contact

Send phone contacts.

send_poll

Send a new poll.

send_dice

Send a dice with a random value from 1 to 6.

send_chat_action

Use this method when you need to tell the user that something is happening on the bot's side.

add_paid_message_reaction

Adds the paid message reaction to a message.

set_reaction

Use this method to change the chosen reactions on a message.

download_media

Download the media from a message.

stream_media

Stream the media from a message chunk by chunk.

edit_message_text

Edit the text of messages.

edit_inline_text

Edit the text of inline messages.

edit_message_caption

Edit the caption of media messages.

edit_inline_caption

Edit the caption of inline media messages.

edit_message_media

Edit animation, audio, document, photo or video messages, or to add media to text messages.

edit_inline_media

Edit inline animation, audio, document, photo or video messages, or to add media to text messages.

edit_message_reply_markup

Edit only the reply markup of messages sent by the bot.

edit_inline_reply_markup

Edit only the reply markup of inline messages sent via the bot (for inline bots).

edit_cached_media

Edit a media stored on the Telegram servers using a file_id.

stop_poll

Stop a poll which was sent by you.

delete_messages

Delete messages, including service messages, with the following limitations:

get_chat_sponsored_messages

Returns sponsored messages to be shown in a chat; for channel chats only.

get_chat_history

Get messages from a chat history.

get_chat_history_count

Get the total count of messages in a chat.

read_chat_history

Mark a chat's message history as read.

get_messages

Get one or more messages from a chat by using message identifiers.

get_chat_pinned_message

Returns information about a newest pinned message in the chat.

get_callback_query_message

Returns information about a message with the callback button that originated a callback query.

get_replied_message

Returns information about a non-bundled message that is replied by a given message.

view_messages

Informs the server that messages are being viewed by the current user.

get_discussion_message

Get the first discussion message of a channel post or a discussion thread in a group.

get_discussion_replies

Get the message replies of a discussion thread.

get_discussion_replies_count

Get the total count of replies in a discussion thread.

search_global

Search messages globally from all of your chats.

search_global_count

Get the count of messages resulting from a global search.

search_messages

Search for text and media messages inside a specific chat.

search_messages_count

Get the count of messages resulting from a search inside a chat.

search_public_messages_by_tag

Searches for public channel posts containing the given hashtag or cashtag.

count_public_messages_by_tag

Get the count of messages with the provided hashtag or cashtag.

vote_poll

Vote a poll.

retract_vote

Retract your vote in a poll.

translate_text

Translates a text to the given language.

translate_message_text

Extracts text or caption of the given message and translates it to the given language.

delete_chat_history

Deletes all messages in the chat.

send_screenshot_notification

Notify the other user in a chat that screenshot of the chat was taken.

send_checklist

Send a new checklist.

edit_message_checklist

Use this method to edit a checklist.

mark_checklist_tasks_as_done

Add tasks of a checklist in a message as done or not done.

Chats#

Chat Forum Topics#

get_forum_topic_icon_stickers

Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user.

create_forum_topic

Use this method to create a topic in a forum supergroup chat or a private chat with a user.

edit_forum_topic

Use this method to edit name and icon of a topic in a forum supergroup chat or a private chat with a user.

close_forum_topic

Use this method to close an open topic in a forum supergroup chat.

reopen_forum_topic

Use this method to reopen a closed topic in a forum supergroup chat.

delete_forum_topic

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.

hide_forum_topic

Use this method to hide a topic in a forum supergroup chat.

unhide_forum_topic

Use this method to unhide a topic in a forum supergroup chat.

get_forum_topics

Get one or more topic from a chat.

get_forum_topic

Get one or more topic from a chat by using topic identifiers.

toggle_forum_topic_is_pinned

Changes the pinned state of a forum topic; requires can_manage_topics right in the supergroup.

Users#

Contacts#

Password#

Bots#

Stickers#

Stories#

can_post_story

Checks whether the current user can post a story on behalf of a chat.

get_stories

Get one or more stories from a chat by using stories identifiers.

get_chat_active_stories

Get all non expired stories from a chat by using chat identifier.

get_chat_archived_stories

Get all archived stories from a chat by using chat identifier.

post_story

Posts a new story on behalf of a chat.

edit_story

Changes content, privacy settings and caption of a story.

edit_business_story

Edits a story previously posted by the bot on behalf of a managed business account.

delete_stories

Deletes a previously sent story.

delete_business_story

Deletes a story previously posted by the bot on behalf of a managed business account.

hide_my_story_view

Activates stealth mode for stories, which hides all views of stories from the current user in the last "stories_stealth_past_period" seconds and for the next "stories_stealth_future_period" seconds; for Telegram Premium users only.

forward_story

Forward story.

toggle_story_is_posted_to_chat_page

Toggles whether a story is accessible after expiration.

Payments#

Phone#

Advanced#

Methods used only when dealing with the raw Telegram API. Learn more about how to use the raw API at Advanced Usage.

invoke

Invoke raw Telegram functions.

resolve_peer

Get the InputPeer of a known peer id.

get_file

save_file

Upload a file onto Telegram servers, without actually sending the message to anyone.