Rasa exceptions issue with Telegram, Please help

Hi All.

I hope you are all doing well. I am building a chatbot in which form is used to send custom messages on Form Submit. I do receive the message on telegram, but somehow message comes 4 times and I see exceptions in the log which I could not relate. I need some help.

2020-05-10 18:39:57 ERROR    rasa.core.channels.telegram  - Exception when trying to handle message.Wrong url host
[2020-05-10 18:39:57 -0700] [12553] [ERROR] Exception occurred while handling uri: 'http://xxxxx.ngrok.io/webhooks/telegram/webhook'
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sanic/app.py", line 976, in handle_request
    response = await response
  File "/usr/local/lib/python3.7/site-packages/rasa/core/channels/telegram.py", line 252, in message
    metadata=metadata,
  File "/usr/local/lib/python3.7/site-packages/rasa/core/channels/channel.py", line 83, in handler
    await app.agent.handle_message(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/rasa/core/agent.py", line 486, in handle_message
    return await processor.handle_message(message)
  File "/usr/local/lib/python3.7/site-packages/rasa/core/processor.py", line 107, in handle_message
    await self._predict_and_execute_next_action(message.output_channel, tracker)
  File "/usr/local/lib/python3.7/site-packages/rasa/core/processor.py", line 538, in _predict_and_execute_next_action
    action, tracker, output_channel, self.nlg, policy, confidence
  File "/usr/local/lib/python3.7/site-packages/rasa/core/processor.py", line 651, in _run_action
    await self._send_bot_messages(events, tracker, output_channel)
  File "/usr/local/lib/python3.7/site-packages/rasa/core/processor.py", line 580, in _send_bot_messages
    await output_channel.send_response(tracker.sender_id, e.message())
  File "/usr/local/lib/python3.7/site-packages/rasa/core/channels/channel.py", line 193, in send_response
    await self.send_image_url(recipient_id, message.pop("image"), **message)
  File "/usr/local/lib/python3.7/site-packages/rasa/core/channels/telegram.py", line 41, in send_image_url
    self.send_photo(recipient_id, image)
  File "/usr/local/lib/python3.7/site-packages/telegram/bot.py", line 65, in decorator
    result = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/telegram/bot.py", line 90, in decorator
    result = self._request.post(url, data, timeout=kwargs.get('timeout'))
  File "/usr/local/lib/python3.7/site-packages/telegram/utils/request.py", line 309, in post
    headers={'Content-Type': 'application/json'})
  File "/usr/local/lib/python3.7/site-packages/telegram/utils/request.py", line 223, in _request_wrapper
    raise BadRequest(message)
telegram.error.BadRequest: Wrong url host

Hi Rick,

It looks like your ngrok URL is incorrect. You’ve configured it as http://xxxxx.ngrok.io/webhooks/telegram/webhook but you need to install and run ngrok which will generate a dynamic URL specific to your system.

Greg

Exception when trying to handle message.Wrong file identifier/http url specified [2020-05-12 07:20:58 -0400] [18131] [ERROR] Exception occurred while handling uri: ‘http://xxxxxxxxx.ngrok.io/webhooks/telegram/webhook

Same issue here as well I have configured https url from ngrok And I see this issue apprears only when I have an image response in my utterence.For normal text it works fine.

also my ngrok gives

POST /webhooks/telegram/webhook 500 Internal Server Error

As tested with @karen-white works for https hosted images but fails for ones hosted in http or local

Hi Stephens, Thanks for the response , I have redacted the ngrok host name for this post.

Thanks , so you only facing this issue with images ?

yes, this only with images which are not hosted publically accessible and not https server …a normal google image will work checked with https://imgur.com/ it worked

I’m getting the same error, but not with images. Certain types of text that come back from the custom action server are causing telegram to keep responding to messages that aren’t sent. I have one message that has \n breaks and it doesn’t get sent. Not sure what’s going on or how to debug it

Hi, did you solve it?

Facing the same issue. Any suggestion on fixing this?

anybody has a solution for this?