We have just installed Pyrogram. In this page we’ll discuss what you need to do in order to set up a project with the framework.
The first step requires you to obtain a Telegram API key.
In order to do so, follow Telegram’s instructions at https://core.telegram.org/api/obtaining_api_id and make sure you understand and abide to the rules for third-party clients and libraries explained there.
The API key consists of two parts: api_id and api_hash. Keep it secret.
Having the API key from the previous step in handy, we can now begin to configure a Pyrogram project: pass your API key to Pyrogram by using the api_id and api_hash parameters of the Client class:
from pyrogram import Client api_id = 12345 api_hash = "0123456789abcdef0123456789abcdef" app = Client("my_account", api_id=api_id, api_hash=api_hash)