This is a simple bot that returns your Telegram Chat ID when you send a message to the bot.
It is also a simple proof of concept to deploy serverless Telegram Bot to Vercel's Now.
For local development polling mechaninsm is used to get Telegram messages.
-
Create
.env
file with yourTELEGRAM_TOKEN
. (TIP: Make sure to create a development bot, so you don't override production) -
Install dependencies with
npm i
-
Run with
npm start
ornpm run dev
for watching (nodemon
is required, if you don't have it installed simplenpm i -g nodemon
) -
Talk to your bot
Once you have a Vercel account and Vercel CLI installed, simple deploy with now
command. (Make sure to have setted up TELEGRAM_TOKEN
as Environment Variable).
During build phase, Vercel will run npm run now-build
, which will execute build.js
and configure Telegram Bot using webhook.