Configuring a Telegram Bot Webhook using node-telegram-bot-api

Hobby Telegram bot with node-telegram-bot-api. Initially, I used polling with:

const telegramService = require('node-telegram-bot-api');
telegramService.begin({ pollMode: true });

Now, how can I deploy a webhook on Netlify/Vercel?

hey i got mine work on vercel by using an express endpoint wrapped with serverless-http. had issues where missing a slash on the webhook url messed things up. check that and it should work

I recently migrated from polling to webhooks on Vercel for a similar Telegram bot project, and the process was relatively straightforward after some trial and error. I set up a serverless function to serve as my webhook endpoint and adjusted my code to handle incoming updates directly on that function. The key was ensuring that the endpoint URL was correctly configured in the device settings of my bot upon deployment. The documentation provided by both node-telegram-bot-api and Vercel was instrumental in understanding environment variables and endpoint management.