A starter template for building Telegram bots in Go.
The repository includes a runnable application shape with polling and webhook support, command menu sync, health probes, inline and callback demos, and session storage backed by Redis or an in-memory fallback.
- Create a bot with BotFather and get the token.
- Copy the environment file.
- Set
TELEGRAM_BOT_TOKEN. - Run the bot in polling mode.
cp .env.example .env
make runMinimum .env example:
TELEGRAM_BOT_TOKEN=123456:replace-me
BOT_MODE=pollingThen open the bot in Telegram and try:
/start
/help
/ping
/echo hello world
/keyboard
/menu
/session
cmd/serveras the single process entrypoint- Environment-based configuration and validation
- Polling and webhook transport modes
- Telegram command menu synchronization on startup
- Built-in command and interaction demos
GET /healthzandGET /readyz- Redis session storage with automatic in-memory fallback
- Docker Compose files for local infrastructure and containerized runs
Use the documentation site for full setup and operational details:
- Getting started
- Integration and extension guidance
- Architecture and request flow
- Session storage behavior
- Configuration and deployment
The documentation site is built from the gh-pages/ folder and deployed with GitHub Pages.
make fmt
make lint
make test
make tidy