Anyone got telegram webhooks working?

Hey!

After fidling a bit with chat_id vs user_id, i got hass to boot up but the webhook still not working.

This is the error i got:

telegram.error.BadRequest: 'Bad Request: bad webhook: Webhook can be set up only on ports 80, 88, 443 or 8443

Anyone knows how to fix this?

Kind regards,
Falka

Not sure. Is your home-assistant exposed to the internet ? webhook requires this.

Yes it is. :confused:

any newswith the webhooks?

I’ve tried to run it, but got the very same error :frowning:

update:
I’ve configured another bot [didn’t want to mess with my “main” buddy, who helps me with other things ;)]
this time everything went smooth, and webhooks works fine.

one thing I’ve added in comparison with first bot is custom url with proper port. just to override base_url configuration [even tho it’s the same url, I’ve got different port attached to hass.io dashboard]. worked like a charm

Could you tell me how you configured bot? I have the same error:

telegram.error.BadRequest: Bad webhook: webhook can be set up only on ports 80, 88, 443 or 8443

you have to add
url: “homeassistant public ip/dns”:8443/80/88/443 (choose only one port)
example: myhome.dyndns.org:8443

make a port forwarding on your router from source port 8443/80/88/443 to destination port 8443/80/88/443 for your hassio device.

In addition to the above you have to add “server_port: 8443” to your http config, it is not read off the end of the url like I was expecting

Thank you so much! You made my bot working again :slight_smile:

Got it working like this, with port 8443 forwarded to my HomeAssistant server, 8123 is still my server port.

telegram_bot:
  - platform: webhooks
    url: !secret telegram_url  # myhome.example.org:8443
    api_key: !secret telegram_api_key  # 123456789-some-randomstring-hash
    allowed_chat_ids: !secret telegram_allowed_chat_ids  # [1234567890, -9876543210]