I built a conversational AI using the Rasa framework and have deployed it on Heroku. Now, I want to connect it with Telegram so users can interact with my bot through the app.
I’m uncertain about the necessary steps to link my Rasa application with the Telegram bot API. What adjustments need to be made in the configuration? Should I use webhooks or polling? Additionally, are there certain environment variables or credentials that I need to set up in my Heroku app?
Any help on this integration process would be greatly appreciated. A clear, step-by-step guide would really assist me in getting my Rasa bot up and running on Telegram.
When connecting your Rasa bot to Telegram on Heroku, using webhooks is the preferred method as it aligns better with Heroku’s architecture. First, ensure you include your Telegram bot token in the credentials.yml file. The webhook URL should be set to https://yourapp.herokuapp.com/webhooks/telegram/webhook. Since Heroku manages SSL certificates automatically, you won’t have to worry about that aspect. It’s also advisable to keep your bot token secure by storing it as an environment variable in the Heroku configuration. If issues persist, enabling debug logging in Rasa can help identify any incoming message problems.
webhooks worked for me too, but dont forget to add the --enable-api flag to your rasa run command in the Procfile. keep your heroku dyno awake or telegram will timeout - i use uptimerobot to ping it. double-check your webhook url format is exactly right, because connection failures happen silently if its wrong.
Had the same issues when I deployed my Rasa bot on Heroku for Telegram. Webhooks are definitely the right approach, but here’s what helped me get it working: Set the PORT environment variable in Heroku since they assign ports dynamically. Update your endpoints.yml with your Heroku app domain URL. The webhook verification tripped me up - Telegram needs consistent access to your endpoint. Test everything first using Telegram’s setWebhook API before going live. And don’t hardcode your bot token - stick it in Heroku’s config vars for security.