DEV Community

Cover image for I Built a Simple Telegram Bot to Find User and Chat IDs
Ruslan
Ruslan

Posted on AI-assisted

I Built a Simple Telegram Bot to Find User and Chat IDs

Sometimes you need a Telegram user ID or a group chat ID, and finding it turns into a bunch of unnecessary steps.

I built Telegram Info Bot to make that easier. Send a command, get the information, copy what you need.

What it does

The bot has five commands:

  • /me - your Telegram ID and profile details
  • /chat - current chat ID, type, and title
  • /start - get started
  • /help - available commands
  • /privacy - how the bot handles data

It works in private chats and groups.

Tech stack

I built it with Python, FastAPI, and aiogram. The repository also includes Docker support and automated checks.

Deploying on Vercel

You can deploy your own instance on Vercel:

  1. Fork the repository and import it into Vercel.
  2. Select the FastAPI preset.
  3. Add BOT_TOKEN and WEBHOOK_SECRET to the Production environment.
  4. Deploy and check /health/ready.
  5. Set WEBHOOK_BASE_URL locally and register the Telegram webhook using the included CLI.

The README covers the exact commands, along with local development and Docker setup.

Try it

Bot: https://t.me/TgProfileInfoBot

Source code: https://github.com/ruslanty/telegram-info-bot

The project is open source under the MIT license. If you use it or run into something that could be improved, I'd be interested to hear about it.

Top comments (0)