Is it possible two or more telegram bots?

Hi there! I’m trying to configure two telegram bots: the first is for normal, not critical notifications, such “My girlfriend is arriving home”, or “You left the computer turned on”… The second would be to critical notifications: alarm triggers, etc, so I can set a noisy tone for that bot, and that bot never will be silenced)

So, I set something like this:

telegram_bot:
  - platform: polling
    name: telegram_alarm
    api_key: whatever1
    allowed_chat_ids:
      - 1234
  - platform: polling
    name: telegram_house
    api_key: whatever2
    allowed_chat_ids:
      - 1234

notify:
 name: telegram_alarm
    platform: telegram
    chat_id: 1234
  - name: telegram_house
    platform: telegram
    chat_id: 1234

The thing is… it does not work. It does not matter what notify object I use (telegram_alarm or telegram_house), I always get the message on the first “telegram_bot” declared.

Am I doing something wrong or actually it is just not possible?

Hello guys,

I’m looking for the same multiple telegram bot option, does anyone knows if it is possible?

thanks a lot!

I achieve something similar with my configuration.

I have one bot, but multiple chats open with that bot. One is directly with the bot, another is in a ‘group’ chat. My direct chat with the bot has notifications silenced and the group chat has notifications

2 Likes

Thanks @flamingm0e, it would be a nice workaround for the moment. Is it possible for you to share your code? would be great for us!

My notify.yaml:

- name: HASShole
  platform: telegram
  chat_id: -1234567
- name: HASSbot
  platform: telegram
  chat_id: 1234567

My telegram.yaml:

- platform: broadcast
  api_key: !secret telegram_api
  allowed_chat_ids:
    - 1234567
    - -1234567

When I call a notification alert, I use notify.HASShole or notify.HASSbot depending on what I need.

You can have multiple group chats setup with your bot as well, since you only need your chat ids for them.

1 Like

Could you show me how to include it in configuration.yaml?

I break my configuration up into different yaml files for my sanity when trying to read my configs.

my telegram.yaml is nothing more than a file I created for my telegram_bot: section of the configuration.

so in your configuration.yaml:

telegram_bot:
  - platform: broadcast
    api_key: !secret telegram_api
    allowed_chat_ids:
      - 1234567
      - -1234567

My api key is in my secrets.yaml

1 Like

“Hasshole” :joy:

Edit: oh wow, I dug this up from the grave :flushed:

Who’s the hasshole now?

1 Like