![]() Click on ‘Create a service’ to create your new worker.In this tutorial, we will utilise Cloudflare Workers to create a POST endpoint which we will set up as our webhook for our Telegram bot. There are many free serverless function options available: Cloudflare Workers, Vercel Serverless functions, etc. ![]() Instead, we will use serverless functions. Our endpoint will receive that POST request with the payload, and with that, we can respond to the user.īut does this mean we will also need a server to accept these POST requests? Yes, but we do not need the server to be running 24/7. From our custom endpoint, we are then free to do whatever we want with this knowledge that our bot has received a message, and we can respond to it.įor example, when our bot receives a message from a user, telegram will send a POST request with a payload containing information about that message (the user, message text, time, etc) to our pre-defined endpoint. Setting a webhook for your telegram bot means that whenever your bot receives a new message, telegram will send that update to your pre-defined webhook endpoint. Today, we will explore the options of webhooks. There aren’t many free options available to keep a server running 24/7, so that was a problem. This means that in order to deploy it, we would need a server running 24/7 that keeps polling for updates. Many tutorials make use of the polling method with a NodeJS or Python server, that polls (or pulls) any messages received by the bot to the server. Introductionįor telegram bot development, there are generally 2 methods used: polling and webhooks. In this tutorial, I will be showing you how you can deploy your telegram bot and keep it running 24/7 entirely for free.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |