Expose localhost RASA chatbot for Telegram Integration

This tutorial will show how you can expose your RASA chat bot to integrate it with Telegram.

1. Initialize a RASA project

You can simply initialize a new project.

$ rasa init --no-prompt

2. Create a Telegram Bot

Search @BotFather on telegram. Use '/newbot' to create a Telegram bot. Follow instructions until you set your bot name & get your Token for accessing Telegram's HTTP API.

3. Reserve a sub-domain specific for your project

You can reserve loclx.io subdomain or use a custom domain (explained here).

loclx domain reserve --subdomain mybot

4. Expose RASA server with LocalXpose

The default port for RASA server is 5005.

loclx tunnel http --reserved-domain mybot.loclx.io --to :5005

If you want these ports to be exposed during boot, you can create a systemd unit file as explained here.

5. Edit your credentials.yml

Edit your credential.yml file and add your access_token , verify (your bot name) & webhook_url (replace with your domain).

telegram:
  access_token: "826487496:AAE1C_rllVgoQ47sOJ9faM26nL6oE1ZcQE4"
  verify: "testxyzbot"
  webhook_url: "https://mybot.loclx.io/webhooks/telegram/webhook"

Talk to your Telegram bot

Search for User 'testxyzbot' & start chatting.

This is how you can have a working Telegram bot powered by RASA NLU with LocalXpose do the connecting for you.

Last updated

Was this helpful?