English | Русский
Telegram-bot template (fastapi-aiogram-ngrok-template-bot)
Template for Telegram-bot that using webhook. Written in Python with aiogram and FastAPI
-
Create a Telegram bot using @BotFather, copy API token
-
Rename the
.env.example
file to.env
and fillBOT_API_TOKEN
field with copied token -
Create an account on ngrok, copy your authentication token and paste it to
NGROK_AUTHTOKEN
field in.env
-
Create an HTTPS Edge on ngrok dashboard, copy URL in Endpoints section and paste it to
NGROK_URL
field in.env
file -
Copy edge label without
edge=
in beginning and paste it toNGROK_EDGE
field in.env
file
For Windows:
- Install and start Docker Desktop
For Linux:
-
Install
docker
,docker-compose
packages with package manager of your distro -
Run this command in root of project:
docker compose up --build
- Check the bot in Telegram. Search it by the username which you gave to @BotFather