Telegrm chatbot not working. throuwing error 409

I have got the telegram notify to work. But command does not work.

I’m using the polling method

config:
telegram_bot:

  • platform: polling
    api_key: <my api key>
    allowed_chat_ids:
    • <my chatID>

automation:
alias: ‘Telegram bot that reply pong to ping’
hide_entity: true
trigger:

  • platform: event
    event_type: telegram_command
    event_data:
    command: ‘/ping’
    action:
  • service: notify.TelegramMartin
    data:
    message: ‘pong’

I do not get a response and nothing in the log files

How ever when I start hass manually with the hass command. I’m getting this error
ERROR (MainThread) [homeassistant.components.telegram_bot.polling] Error 409 on https://api.telegram.org/bot<my api key>/getUpdates

If I go to that link then the result is

{“ok”:true,“result”:[]}

Anybody any idea

Nobody? …

The 409 error means “Another webhook is active”. That means something has set-up a webhook to the bot, instead of using polling.

UPDATE 1: I’m getting these errors since i upgraded to 0.47.1. Must be a bug. When I downgraded to 0.46.1 - it’s gone, or at least it doesn’t repeat every second.

UPDATE 2: This is not a bug, it’s a feature. Apparently the chatbot was not working properly before 0.47, that’s why this error did not appear so often. This error only happens if you’re using the same bot for multiple hass instances, or polling it for updates from hass and some other software.

If you need simply notifications, I think you should be able to use the same bot from multiple instances. Clearly this won’t work if you need the chatbot functionality. I’ve opened an issue in the bugtracker - https://github.com/home-assistant/home-assistant/issues/8183 - it’d be helpful if you can give some feedback as well.

I Use to had webhooks installed but never got it to work. Perhaps it is still active somewhere. But I can’t find how to deactivate it on the bot.

I’m reading some documentation from telegram right now. I will get back to you

To delete the webhook from your bot you need to navigate to the following URL.
Ihttps://api.telegram.org/bot’'/deleteWebhook

This is the result
{“ok”:true,“result”:true,“description”:“Webhook is already deleted”}

I have restarted HASS
sudo systemctl restart [email protected]

Still no ping to pong

There’s a new platform for the chatbot already in the works, that will only send messages (no receiving). It should be released with the next version of HASS.

got it to work

configuration is wrong

was missing - in front of alias

If that resurfaces you should take a look at the new Telegram broadcast component