To write a Telegram bot, you'll need to do the following:

To build a Telegram bot without hosting with zero dollar in cost


  1. Create a new bot by talking to the BotFather. The BotFather is a bot that allows you to create new bots and change their settings. To create a new bot, send the command /newbot to the BotFather. He will ask you for a name for your bot and a username. The name will be displayed in contact lists, and the username is what you'll use to access the bot.

  2. Set up a webhook to receive updates from the bot. A webhook is a way for your bot to receive updates from Telegram. To set up a webhook, you'll need to specify a URL for your bot to receive updates at, and then register this URL with Telegram.

  3. Write the code for your bot. You can write your bot in any programming language that has a library for interacting with HTTP servers. To process updates from the bot, you'll need to set up a server that listens for updates and processes them.

  4. Test your bot. You can test your bot by sending it commands and seeing how it responds. You can also use the BotFather's /setinline command to set up inline queries for your bot, which allows users to use your bot in any chat by typing its username and a query.

  5. Deploy your bot. Once you have your bot working the way you want it to, you'll need to deploy it to a server so it can run continuously. You can use a service like Heroku or AWS to host your bot.