# Expose localhost RASA chatbot for Telegram Integration

{% hint style="warning" %}
This tutorial assumes that you have access to your Telegram account (create [here](https://web.telegram.org/#/login)) and have RASA installed (instructions[ here](https://rasa.com/)).
{% endhint %}

## 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.

![](/files/-M6pC8_PNGZ02yU9Lqgk)

## 3. Reserve a sub-domain specific for your project

> You can reserve loclx.io subdomain or use a custom domain (explained [here](https://docs.localxpose.io/tutorials/create-a-custom-domain-name)).

```bash
loclx domain reserve --subdomain mybot
```

## 4. Expose RASA server with LocalXpose

The default port for RASA server is 5005.

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

{% hint style="info" %}
If you want these ports to be exposed during boot, you can create a systemd unit file as explained [here](https://docs.localxpose.io/tutorials/access-your-raspberry-pi-remotely#5-create-a-unit-file).
{% endhint %}

## 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).

```bash
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.

{% hint style="warning" %}
We haven't added any stories or domains. This bot is simply running off the default init model. Check [official rasa docs](https://rasa.com/docs/) for more info.
{% endhint %}

![](/files/-M6pNPOlLRBIAywmFjSU)

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://localxpose.gitbook.io/docs/tutorials/expose-localhost-rasa-chatbot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
