Hi … I was not able to find the answer in the official docs so I have to ask here …
What do I need to send Telegram messages to mutliple receipients (=telegram groups)? Is that possible at all? Is a Telegram bot needed (most of the docs state that one is needed but I see no technical reason).
I kow how to send messages, but I have not found a way to send a message either to “group A” or “group B”. (It does not have to be sent to both though)
it’s the same thing with sending messages to individuals. you just need to get the group chat ID the same way you get the individual chat ID. Group chat ID normally starts with negative “-”.
Made a little progress …
I forgot to add the allowed IDs of the groups to configuration.yaml. This resulted in the following message in home-assistant.log:
WARNING (Thread-4) [homeassistant.components.telegram_bot] Unallowed targets: [-xxxxxxxxx], using default: -yyyyyyyyy
But it still does not work …
What’s not clear to me: do I really need a bot for that?
In previous versions I have configured HA to work with two Telegram Bots because you only have to configure two bots with their corresponding api keys, without needing a telegram bot.
Now, I understand that you have to configure a bot of the telegram with a key api and then configure the bot of the telegram without key api in notify …
So now I do not know how to configure HA to be able to send notifications to two different bots.
How do you do to work with two or more telegram groups?
I have this configuration, but it doesn’t works:
telegram_bot:
- platform: polling
api_key: 000000000:xxxxxxxxx // Group 1 key
allowed_chat_ids:
- 1234567 // This is my user_id
- platform: polling
api_key: 000000000:yyyyyyyyy // Group 2 key
allowed_chat_ids:
- 1234567 // This is my user_id
notify:
- name: telegram_notifications
platform: telegram
chat_id: 1234567 // This is my user_id
- name: telegram_alarms
platform: telegram
chat_id: 1234567 // This is my user_id
Of course, only works one telegram group… I want two telegram groups…
telegram_bot group1:
- platform: polling
api_key: 000000000:xxxxxxxxx // Group 1 key
allowed_chat_ids:
- 1234567 // This is my user_id
telegram_bot group2:
- platform: polling
api_key: 000000000:yyyyyyyyy // Group 2 key
allowed_chat_ids:
- 1234567 // This is my user_id
Look at the domain thing if there show up two telegram bots and what their names are, maybe? I really don’t know, I was just thinking along and I hoped my proposal would work
The same.
I need to receive different kind of information from two bots. On one of my spot I used home-assistant v0.43.2 and all work perfect.
On my new spot with latest home-assistant I can’t do it anymore!
@tmeringer did you managed to get it work ? Previously I was a user of Pushbullet but couldn’t get to work out for multiple recipients. Recently moved to Telegram primarily because of the restriction in pushbullet’s notification numbers in a month (which seems insufficient at the end of month).
However, Telegram is another beast in the town I must say, though it’s bot concept was somewhat difficult to grasp at first, but it’s amazing considering the possibility it offers.
After several attempts, my initial concerns of multiple recipient issue is resolved with Telegram.
The configuration was something like below:
notify:
- name: telegram_notifications
platform: telegram
chat_id: 1234567
#This is my user_id
- name: telegram_alarms
platform: telegram
chat_id: 4567891
#This is second chatID
telegram_bot:
- platform: polling
api_key: 000000000:xxxxxxxxx #user 1 api (user2 API key could be also used; the source of the notification would be changed then)
allowed_chat_ids:
- 1234567 #User1 Chat_ID
- 4567891 #User2_ChatID
To get the chat ID for both users initially, I had to create 2 bots with each users and then following the instruction (in HASS documentation), I could collect the API key and Chat_ID for both users.
I then modified my automation in a way so that notifications are now directed to specific users based on the condition/information. Now I am looking forward to do more automation with camera and Telegram.
I want send notification to 2 device. how can i meke automation.
Here is my automation.yaml
- action:
- data:
message: Light is on
- service: notify.telegram_toor
- service: notify.telegram_mini
alias: light is on
id: '67543567847728'
trigger:
- entity_id: light.room_21
from: 'off'
platform: state
to: 'on'
Just use web.telegram.org and select the group. The ID can be found in the URL then (?p=g123456789). Just replace “g” with “-” then. So the group ID would be “-123456789” then.