Is it possible to get multiple telegram bots?


Is there any way use two different bots in telegram?


Sure, you can have it.


Great. How?


Try this:

  - platform: polling
    api_key: 1111111111333:asdfasdfasdfasdfasdfasdfasdfsaf
      - 11111111111

  - platform: polling 
    api_key: 222222222333:asdfasdfasdfasdfasdfasdfasdfasf 
      - 2222222222


Thanks for the support but once I’ve done that I’m not sure how to select the right bot from which to send the message.

For example, I have a notify component set up for my original bot:

Example configuration.yaml entry for the notifier


    platform: telegram
    chat_id: CHAT_ID_2

I want to use two different bots in the same chat (one for health reminders, the other for problems in the house/alerts).


Now I understand your need. In fact I use 2 bots, but one is just for inputs (managed by node-red). It may be possible to achieve what you want with node-red, but I don’t know if you can using just HA.


Unfortunately I’m using hassbian so nodered is difficult to install and use



You just install nodered as indicated on their website. It’s no different than installing any other applications


I have two separate bots created, 1 for general info and 1 for security alerts. Funny thing is that this used to work quite a few revisions ago. I believe it worked back then because you could specify an API Key for the notifier like so

  - platform: telegram
    name: telegram_HA
    api_key: 123456AABBCCDDEEFFF
    chat_id: 123456789ZZ

This appears to be ignored now and will only deliver to the first configured Telegram Bot. Anyone have any ideas?


I have the same question. Anyone know?


Same here. would like a separate bot for alarm notifications and on with general info…



Same here too. I couldn’t get it working with only HA, but I got it working using the MQTTWARN. You will have another app/docker running but there’s some advantages in doing so, because you decouple the notifications from HA, which means that if you want change how/who gets a notification you can do that without restarting HA. The basic idea is that you publish to a topic what message you want to send, and on MQTTWARN you create the rules on how and to who this message should be sent. Since HA can talk directly to the MQTT instead of using a component you should create a script, like this:

    - service: mqtt.publish
          payload: "{{ message }}"
          topic: mqttwarn/alert/msg

you may call the script like this:

- service: script.homealert
            message: "Danger Will Robinson"

The configuration of the mqttwarn is simple, the relevant part of mine (i.e. not including the mqtt part) looks like this:

timeout = 30
parse_mode = 'Markdown'
token = '<your_bot_token>'
targets = {
      'j01' : [ '#-33xxxxxxxx' ],
      'j02' : [ '#-2xxxxxxxxx' ]

targets = telegram:j01

targets = telegram:j02

As you can see, you don’t need two bots! Just create different groups and include people/bots you want.


I actually solved my idea in a different way than having 2 bots.
I have 1 bot but two telegram groups.
1 group for generic notifications and the other for urgent notifications.
I added the chat id’s of those 2 groups to the allowed chat ids:

  - platform: broadcast
    api_key: !secret telegram_api
      - !secret telegram_chatid
      - !secret telegram_chatid2

Then under notify I created 2 items called Bot and BotUrgent with those same chatid’s:

  - name: TelegramBot 
    platform: telegram
    chat_id: !secret telegram_chatid
  - name: TelegramBotUrgent   
    platform: telegram
    chat_id: !secret telegram_chatid2

So now in an automation I can send it to either of the 2.
If you also add (both under telegram_bot as under notify) for instance the chatid of your own telegram account (so not the groups but your private one), you can also send notifications only to yourself instead of the groups. I did that because my wife is in the groups but some notifications really only need to go to myself.


Having groups you will see messages arriving from different “users” in telegram android/iphone app correct?
Will investigate how to do these different groups, and use also @clyra idea of mqtt, I like way more of doing changes without having all the time to restart HASS


Also interested how many groups you guys use, and for each group which type of messages /notifications you use (for inspiration)