Home

Awesome

Telegram Bot Template for Vercel

This template is built on the grammY, thanks to which it supports both Serverless (Node.js) and Edge Runtime.

How to use

A. Click the Deploy button ...

Deploy with Vercel

... and follow the instructions on next page.

B. Click the Use this template button ...

... and connect the repository to your project on Vercel.

C. Clone the template to your host ...

... and run the bot locally.

Workflow

Local development

  1. Install dependencies (npm i) and link Vercel project
  2. Pull envs from Vercel ( npm run env) or set them in a .env file
  3. Run the bot in polling mode ( npm start) or use the Vercel dev server

Vercel deployment

When you push a commit to a GitHub repository, Vercel runs build script and assigns a unique URL that will be set as the URL for incoming webhooks.

Lifecycle

Until you run the bot locally, your code will run on the Vercel side, where you can view runtime logs and usage.

About this template

Environment variables

Telegram bot token from @BotFather (required)

TELEGRAM_BOT_TOKEN = "..."

Secret token for incoming requests (optional)

TELEGRAM_SECRET_TOKEN = "..."

Credits

Made with 🌚 by Vladislav Ponomarev