telegram_bot.mdx 1.1 KB

1234567891011121314151617181920212223242526
  1. ---
  2. title: '📱 Telegram Bot'
  3. ---
  4. ### 🖼️ Template Setup
  5. - Fork [this](https://replit.com/@taranjeetio/EC-Telegram-Bot-Template?v=1#README.md) replit template.
  6. - Set your `OPENAI_API_KEY` in Secrets.
  7. - Open the Telegram app and search for the `BotFather` user.
  8. - Start a chat with BotFather and use the `/newbot` command to create a new bot.
  9. - Follow the instructions to choose a name and username for your bot.
  10. - Once the bot is created, BotFather will provide you with a unique token for your bot.
  11. - Set this token as `TELEGRAM_BOT_TOKEN` in Secrets.
  12. - Click on `Run` in the replit container and a URL will get generated for your bot.
  13. - Now set your webhook by running the following link in your browser:
  14. ```url
  15. https://api.telegram.org/bot<Your_Telegram_Bot_Token>/setWebhook?url=<Replit_Generated_URL>
  16. ```
  17. - When you get a successful response in your browser, your bot is ready to be used.
  18. ### 🚀 Usage Instructions
  19. - Open your bot by searching for it using the bot name or bot username.
  20. - Click on `Start` or type `/start` and follow the on screen instructions.
  21. 🎉 Happy Chatting! 🎉