Hi there,
I managed to make my telegram bot work, but I have a problem with targeting my messages to other users.
I defined telegram_bot service with allowed chat IDs in the configuration.yaml plus two notify services, one for me, one for Jo:
telegram_bot:
- platform: webhooks
api_key: !secret api_vomacka
allowed_chat_ids:
- !secret telegram_jo
- !secret telegram_sebastian
notify:
- platform: telegram
name: 'sebastian'
chat_id: !secret telegram_sebastian
- platform: telegram
name: 'jo'
chat_id: !secret telegram_jo
But when I try to target a message or a notification, it always sends it only to me.
Here is an example. This is a callback from keyboard from a previous message:
- alias: 'Telegram Bot Ping'
trigger:
platform: event
event_type: telegram_callback
event_data:
command: "/ping"
action:
- service: telegram_bot.send_message
data_template:
target: !secret telegram_jo
message: "HEY!"
- service: telegram_bot.send_message
data_template:
target: '{{ trigger.event.data.chat_id }}'
message: "Done!"
Instead of Jo getting the message “HEY!” and me getting the message “Done!”, I get both of them.
When I use an automation in HA and I use the notify.jo service, it also sends it to me, so that’s where the problem probably is. I just don’t know why. I triple checked the secrets for chat IDs and they are each different and correct.
I also tried sending a message to Jo’s telegram via API in the web browser address bar and that worked so the User ID is correct.
Does anyone have any idea what I’m doing wrong here?