https://github.com/bushlanovdev/aiogram-fastapi-bot-template
🤖💬 A simple template for creating a telegram bot on webhooks using the aiogram and fastapi
https://github.com/bushlanovdev/aiogram-fastapi-bot-template
aiogram bot python telegram telegram-bot template template-project
Last synced: about 1 year ago
JSON representation
🤖💬 A simple template for creating a telegram bot on webhooks using the aiogram and fastapi
- Host: GitHub
- URL: https://github.com/bushlanovdev/aiogram-fastapi-bot-template
- Owner: BushlanovDev
- License: mit
- Created: 2024-09-22T12:43:33.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-07T19:38:24.000Z (over 1 year ago)
- Last Synced: 2025-03-29T05:04:43.372Z (about 1 year ago)
- Topics: aiogram, bot, python, telegram, telegram-bot, template, template-project
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🤖 Aiogram Fastapi Bot Template
[](https://github.com/BushlanovDev/aiogram-fastapi-bot-template/actions) [](https://www.python.org/downloads/) [](https://pypi.org/project/aiogram/)
A simple template for creating a telegram bot on webhooks using the **aiogram** and **fastapi**
### 💻 Installation
1. Clone project `git clone https://github.com/BushlanovDev/aiogram-fastapi-bot-template.git`
2. Create a virtual venv `python -m venv venv` and `source venv/bin/activate`
3. Install dependencies `pip install -r requirements.txt`
4. Copy config template `cp .env.example .env`
### ✍️ Configuration
Edit the .env file
`APP__DEBUG` `true` or `false`, development mode
`APP__PORT` Port of application for fastapi (`8080`)
`APP__URL` The base domain of the application (`https://example.com`)
`APP__WEBHOOK_PATH` The route to which hooks from telegram will come (`/webhook/tg`)
`APP__DEFAULT_LANGUAGE` Default response language if the user's language is not received in the hook (`en`)
`TG_BOT__TOKEN` Telegram bot secret token
### 🚀 Run bot
For local launch you will most likely need the application [ngrok](https://ngrok.com/) or similar. `APP__URL` needs to
be copied from ngrok window to config.
Run bot `python main.py` or `docker compose up -d`
### 📁 Bot structure
| Folder | Description |
|-------------|------------------------------------------|
| callbacks | Callback data |
| configs | Configuration files |
| handlers | Handlers, commands, callbacks |
| i18n | Localization |
| keyboards | Keyboards reply, inline |
| middlewares | Middlewares for localization, throttling |
| services | Custom libraries |
| states | State objects |