Telegram bot does not respond with Rasa x

Hi,

I followed the Docker-Compose Quick Install deployment procedure Docker-Compose Quick Install and followed the Rasa Master Class video lessons. I used Google Cloud for hosting, ran the certbot for the ssl certificate, integrated with my project on github and created the credentials file for integration with the telegram. The rasa-x page works perfectly, however when I talk to the bot on the telegram I get the request below in the log:

nginx_1            | 2020-02-09T18:49:02.280548875Z 91.108.6.145 - - [09/Feb/2020:18:49:02 +0000] "POST /webhooks/telegram/webhook HTTP/1.1" 200 1578 "-" "-"

However, the bot does not respond on the telegram. Looking at the log, some errors appear:

rasa-production_1  | 2020-02-09T11:47:51.871809910Z     message = self._parse(resp.data)
rasa-production_1  | 2020-02-09T11:47:51.871815392Z   File "/build/lib/python3.6/site-packages/telegram/utils/reque
st.py", line 174, in _parse
rasa-production_1  | 2020-02-09T11:47:51.871820596Z     raise RetryAfter(retry_after)
rasa-production_1  | 2020-02-09T11:47:51.871826197Z telegram.error.RetryAfter: Flood control exceeded. Retry in 1 s
econds
rasa-production_1  | 2020-02-09T11:48:03.594653607Z 2020-02-09 11:48:03 ERROR    pika.adapters.utils.io_services_ut
ils  - Socket failed to connect: <socket.socket fd=22, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('17
2.18.0.8', 55590)>; error=111 (Connection refused)
rasa-production_1  | 2020-02-09T11:48:03.595339411Z 2020-02-09 11:48:03 ERROR    pika.adapters.utils.connection_wor
kflow  - TCP Connection attempt failed: ConnectionRefusedError(111, 'Connection refused'); dest=(<AddressFamily.AF_
INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('172.18.0.5', 5672))
rasa-production_1  | 2020-02-09T11:48:03.599042068Z 2020-02-09 11:48:03 ERROR    pika.adapters.utils.connection_wor
kflow  - AMQPConnector - reporting failure: AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connectio
n refused')
rasa-production_1  | 2020-02-09T11:48:08.608190150Z 2020-02-09 11:48:08 ERROR    pika.adapters.utils.io_services_ut
ils  - Socket failed to connect: <socket.socket fd=22, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('17
2.18.0.8', 55604)>; error=111 (Connection refused)
rasa-production_1  | 2020-02-09T11:48:08.608871181Z 2020-02-09 11:48:08 ERROR    pika.adapters.utils.connection_wor
kflow  - TCP Connection attempt failed: ConnectionRefusedError(111, 'Connection refused'); dest=(<AddressFamily.AF_
INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('172.18.0.5', 5672))
rasa-production_1  | 2020-02-09T11:48:08.609965674Z 2020-02-09 11:48:08 ERROR    pika.adapters.utils.connection_wor
kflow  - AMQPConnector - reporting failure: AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connectio
n refused')
rasa-worker_1      | 2020-02-09T11:47:51.295880857Z 2020-02-09 11:47:51 ERROR    pika.adapters.utils.connection_wor
kflow  - AMQPConnector - reporting failure: AMQPConnectorSocketConnectError: ConnectionRefusedError(111, 'Connectio
n refused')
rasa-worker_1      | 2020-02-09T11:47:56.316261937Z 2020-02-09 11:47:56 ERROR    pika.adapters.utils.io_services_ut
ils  - Socket failed to connect: <socket.socket fd=22, family=AddressFamily.AF_INET, type=2049, proto=6, laddr=('17
2.18.0.7', 45942)>; error=111 (Connection refused)
rasa-worker_1      | 2020-02-09T11:47:56.316716168Z 2020-02-09 11:47:56 ERROR    pika.adapters.utils.connection_wor
kflow  - TCP Connection attempt failed: ConnectionRefusedError(111, 'Connection refused'); dest=(<AddressFamily.AF_
INET: 2>, <SocketKind.SOCK_STREAM: 1>, 6, '', ('172.18.0.5', 5672))

Please, can anyone help me?

Hi @eduardodsaraujo,

To make sure that the issue comes from the telegram connection and is not caused by something else, can you try to run another test by sharing the bot with test users, as described here?

https://rasa.com/docs/rasa-x/user-guide/enable-workflows/#conversations-with-test-users

Hi Arjaan,

It works now, I saw the last part of the text in this link, here:

  • change from : http://<HOSTNAME>:<PORT>/webhooks/<CHANNEL>/webhook
  • to : http://<RASA X HOSTNAME>/core/webhooks/<CHANNEL>/webhook

And I saw that my credentials file was wrong. The bot in the telegram is answering now and I think that the error didn’t appear anymore too. Thank you very much, you saved my life.

1 Like

Hi I am facing the same issue.My telegram bot is not replying.I am getting error File “c:\users\gutanweer\anaconda3\envs\rasa\lib\site-packages\telegram\utils\request.py”, line 245, in _request_wrapper raise BadRequest(message) telegram.error.BadRequest: Bad webhook: failed to resolve host: no address associated with hostname

Can someone help me please.

@eduardodsaraujo where to update the suggested link u gave in ur post?

Thanks in advance

Hi @gulafshan,

The it depends on the rasa x version you have deployed on the GCP.

This is dependent on your Rasa X version. It should work without the /core/ for any version >= 0.27.0: Rasa X Changelog

for version below 0.27.0: quest URL should not be

http://<host>:<port>/webhooks/telegram/webhook

which is wrong.

The request url should be

http://<host>/core/webhooks/telegram/webhook

For version above 0.27.0 you can use:

http://<host>:<port>/webhooks/telegram/webhook

Appreacited your immediate response!

My Rasa X version is 0.28.6 and my telegram credentials look like

telegram:

access_token: “xxxxx” verify: “xxx_bot” webhook_url: “http://xxxx.ngrok.io/webhooks/telegram/webhook”

Even my custom actions are working fine in Rasa Shell but not working with rasa X. Though default scenarios are working in Rasa x.

For telegram my bot is not responsing at all.

Please help me I am trying hard to resolve but no luck.

Thanks a ton :slight_smile: