How to deploy Telegram bot in Vercel Serverless function

Опубликовано: 19 Июнь 2026
на канале: Compiled Dude
605
5

** AD SPACE **

Looking for a flexible side hustle? This platform pays you to work on interesting AI projects, from coding challenges to data analysis. Pass a qualification test and start earning on your own schedule.
Use my referral link to get started:

https://app.outlier.ai/expert/referra...

*****

Create your AI voice clone from just a few minutes of audio with @elevenlabsio. No more
need to record multiple takes to get the audio for your content right. The best thing? Your
clone can even speak almost 30 languages!

https://try.elevenlabs.io/yf672nrp61q2

Tailscan - Browser inspector for Tailwind CSS (AFF link):

tailscan.com/?via=compileddude

** AD SPACE **


-----------------------------



*If you enjoyed this video, please subscribe for more content!*



Here are the steps to deploy a Telegram bot in a Vercel Serverless function:

Create a Next.js project:
npx create-next-app@latest

--

Install the required libraries:
npm i grammy @vercel/node

--

Upload the repository:
No additional steps required.

--

Connect the project to the Vercel platform:
No additional steps required.

--

Create the API route in the Next.js project:
Use the code provided here https://github.com/ciruelosmf/tel_bot...

--

Create a bot in Telegram using the BotFather and obtain the API token.
Set up the webhook using Telegram's API and the Vercel domain:

https://api.telegram.org/bot{{your_bot_api_token}}/setWebhook?url={{Vercel_domain_api_endpoint}}/api/route

--

Add the following line to the project's package.json file:
"type": "module",

Deploy the project and try it out.

#nextjs #programming #telegram #telegrambot