Trying to run a rasa chatbot in Telegram from Okteto

I created a Dockerfile and docker-compose and uploaded it to okteto, I now have a running instance of my rasa bot here in a URL similar to: https://my-server-username.cloud.okteto.net. However, if I try to send a message via telegram (works locally) I get:

2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server2022-11-25 00:12:54 ERROR rasa_sdk.endpoint - Exception occurred during execution of request <Request: POST /webhooks/telegram/webhook>
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-serverTraceback (most recent call last):
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server File "/usr/local/lib/python3.8/site-packages/sanic_routing/router.py", line 79, in resolve
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server route, param_basket = self.find_route(
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server File "", line 9, in find_route
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-serversanic_routing.exceptions.NotFound: Not Found
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-serverDuring handling of the above exception, another exception occurred:
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-serverTraceback (most recent call last):
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server File "/usr/local/lib/python3.8/site-packages/sanic/router.py", line 38, in _get
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server return self.resolve(
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server File "/usr/local/lib/python3.8/site-packages/sanic_routing/router.py", line 96, in resolve
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server raise self.exception(str(e), path=path)
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-serversanic_routing.exceptions.NotFound: Not Found
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-serverDuring handling of the above exception, another exception occurred:
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-serverTraceback (most recent call last):
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server File "handle_request", line 26, in handle_request
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server from socket import socket
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server File "/usr/local/lib/python3.8/site-packages/sanic/router.py", line 66, in get
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server return self._get(path, method, host)
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server File "/usr/local/lib/python3.8/site-packages/sanic/router.py", line 44, in _get
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-server raise NotFound("Requested URL {} not found".format(e.path))
2022-11-25 00:12:54.49 UTCrasa-actions-server-74c86887cc-vdfl2rasa-actions-serversanic.exceptions.NotFound: Requested URL /webhooks/telegram/webhook not found

I double-checked and in my endpoints.yml I have:

action_endpoint:
 #url: "http://localhost:5055/webhook"
 url: "http://rasa-actions-server:5055/webhook"

I’ve tried both to no avail. I also have my okteto.yml as:

name: okteto-rasa
autocreate: true
image: okteto.dev/rasa-server-okteto:latest
command: bash
volumes:
- /root/.cache/pip
sync:
- .:/app
forward:
- 8080:8080
reverse:
- 9000:9000

and my docker-compose.yml as:

version: '3.7'
services:
  rasa:
    image: rasa-server-okteto:latest
    working_dir: /app
    build: "./"
    restart: always
    volumes:
      - ./actions:/app/actions
      - ./data:/app/data
      - ./models:/app/models
    command: bash -c "rm -rf models/* && rm -rf .rasa/* && rasa train && rasa run --enable-api --cors \"*\" -p 8080 --debug"
    ports:
      - '5005:8080' #external:internal
    networks:
      - all

  rasa-actions-server:
    image: rasa-server-okteto:latest
    working_dir: /app
    build: "./"
    restart: always
    volumes:
      - ./actions:/app/actions
    command: ["rasa", "run", "actions"]
    ports:
      - '5055:5055'
    networks:
      - all

finally my dockerfile is:

FROM python:3.8-buster AS BASE

RUN apt-get update && \
    apt-get --assume-yes --no-install-recommends install \
    build-essential \
    curl \
    git \
    jq \
    libgomp1 \
    vim 

WORKDIR /app

RUN pip install --no-cache-dir --upgrade pip

# To install packages from PyPI
COPY ./requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

RUN pip install rasa

# Copy actions folder to working directory
COPY ./actions /app/actions

ADD config.yml config.yml
ADD domain.yml domain.yml
ADD credentials.yml credentials.yml
ADD endpoints.yml endpoints.yml

EXPOSE 5005
CMD ["--help"]

But nothing…so what am I missing here? I’m new to docker and kubernetes…so maybe it’s something obvious…

Hi, have you configured webhook_url for Okteto(Telegram) in credentials.yml?

I have not, how do I need to do that? sorry

Kinda like:

okteto:
  url: "http://host:port/webhooks"

?

I have the one for telegram but not for okteto

You can configure it as follows,

telegram:
  access_token: TELEGRAM_ACCESS_TOKEN
  verify: TELEGRAM_BOT_NAME
  webhook_url: OKTETO_URL/webhooks/telegram/webhook

Ah ok, then I misunderstood. I do have that. It still doesn’t work.

Might something else be missing?

I should also meantion, the url I have used there is the one that point at the rasa service mot at the rasa actions server.

Hi @luisarmando , Okteto does not support Telegram requests nor Whatsapp as it is mentioned on their legal page. I have added image below from their website.

1 Like