Files
uPortal2/bots/meetings_telegram_bot/README.md
T
2026-10-24 20:36:47 +03:00

2.0 KiB

Meetings - Telegram bot

A small standalone Python bot. It polls the API every 15 minutes and posts newly created meetings to a Telegram group. It is not part of Docker; you run it by hand.

Setup

pip install -r ../requirements.txt
cp .env.example .env
# edit .env

.env:

API_BASE_URL=http://localhost:8088
API_LOGIN=bot-user
API_PASSWORD=change-me
TELEGRAM_BOT_TOKEN=123456:ABC-DEF-your-token
TELEGRAM_CHAT_ID=@my-group
TIMEZONE=GMT+3

TIMEZONE sets the zone for the times in posts. Use an IANA name (Europe/Moscow) or a GMT offset (GMT+3, UTC+05:30). Leave it empty to use the machine's local time.

Get the bot token from @BotFather. For a public group use @group_name; for a private group use the numeric chat id (negative).

Run

From the project root:

python bots/run_bot.py             # start the loop
python bots/run_bot.py --once      # one cycle, then exit
python bots/run_bot.py --dry-run   # log only, post nothing
python bots/run_bot.py --check     # validate config, then exit

Stop with Ctrl-C.

Notes

  • On the first run the bot remembers existing meetings without posting them, so it does not spam the group. Only meetings created afterwards are posted.
  • The join link in each post opens the web app's room page, and only appears when the meeting has a room.

Optional: SOCKS5 proxy

SOCKS5_PROXY=socks5://user:password@127.0.0.1:1080

Routes both API and Telegram traffic through the proxy. Leave empty to connect directly.

Troubleshooting

  • CSRF Token Validation Failed: delete state.json (stale cookies) and run again. The bot seeds the csrf cookie itself and sends cookies even when the server marks them Secure, so plain-HTTP setups work.
  • 401 Unauthorized: check API_LOGIN / API_PASSWORD.
  • chat not found: check TELEGRAM_CHAT_ID and that the bot is in the group.
  • Nothing posted: the first run intentionally stays silent. Create a meeting after the bot starts.