RASA problem connecting to Telegram

Hi Guys.

I´m trying to connect my bot directly to my IP (ngrok whats ok but i need connect directly to my server) on Telegram and Twilio WhatsApps.

  1. Telegram:

The problem i think is the next: Telegram use https and my server EC2 only have HTTP, if i search the site online (http://54.80.233.189:8443/) is working and say Hello from Rasa: 1.3.9, and work to in RASA X (with HTTP).

If i send a message from Telegram, Rasa say "httptools.parser.errors.HttpParserInvalidMethodError: invalid HTTP method " so Telegram connect to my server … is must be a HTTPS incompatibily. The problem is i try to start with port 443, 80 or 88 the system denied me. Port 8433 work but i can open html port in my ec2 console.

mycredentials.yml

#telegram:

access_token: “…”

verify: “bot”

webhook_url: “https://54.80.233.189:8433/webhooks/telegram/webhook

  1. Twilio when a message arrive said me

Method not allowed error 405

any help?

I believe you will want to setup ngrok on this machine or nginx or something to get SSL going from your ec2 instance and this should work.

You basically need to replicate what you did locally and ngrok basically sets up SSL for you which would need to be done on this ec2 instance.

@Nicanor

Did you solve this?

I am also facing same issue .My rasa server is running via ngrok but https://f9a8b004.ngrok.io/ gives hello from rasa 1.9.0 but https://f9a8b004.ngrok.io/webhooks/telegram/webhook will say url not found

using rasa run command you will get port number and try to forward it into ngrok

Sorry If I open https://f9a8b004.ngrok.io/ its saying connection refused . 2020-05-11 01:12:43 DEBUG telegram.vendor.ptb_urllib3.urllib3.connectionpool - Starting new HTTPS connection (4): api.telegram.org Traceback (most recent call last): File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 611, in urlopen self._prepare_proxy(conn) File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 827, in _prepare_proxy conn.connect() File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connection.py”, line 294, in connect self._tunnel() File “/usr/local/lib/python3.7/http/client.py”, line 921, in _tunnel message.strip())) OSError: Tunnel connection failed: 403 Forbidden

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/utils/request.py”, line 203, in _request_wrapper resp = self._con_pool.request(*args, **kwargs) File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py”, line 70, in request **urlopen_kw) File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py”, line 148, in request_encode_body return self.urlopen(method, url, **extra_kw) File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py”, line 359, in urlopen return super(ProxyManager, self).urlopen(method, url, redirect=redirect, **kw) File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py”, line 244, in urlopen response = conn.urlopen(method, u.request_uri, **kw) File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 695, in urlopen **response_kw) File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 695, in urlopen **response_kw) File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 695, in urlopen **response_kw) File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py”, line 666, in urlopen _stacktrace=sys.exc_info()[2]) File “/home/cloud-user/.local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py”, line 376, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) telegram.vendor.ptb_urllib3.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘api.telegram.org’, port=443): Max retries exceeded with url: /botxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/setWebhook (Caused by ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 403 Forbidden’)))

The exception was due to telegram api access was blocked in my machine it works now that I have whitelisted

hi,can u help me to solve this isssue im facing same issue.