Telegram bot in group chat

Hi,
I have created a Telegram bot and it writes in the chat with me. Is it possible to change the chat id to a group chat. It would be easier than creating a bot for everyone in my house.

Yes of course you can. I use it. You need to use the chatid of the group.

Walter

Just a quick info for others who might read this.
Sending to a group chat is easy. You have to:

  • Get the group ID the same way you get the UserID
  • Just open Telegram add and add your bot to the group
  • Then check URL: https://api.telegram.org/bot<token>/getUpdates
  • search for the chat: item and note down the ID. It should be a negative number
    sample: ,"chat":{"id":-123456789,"title":"MyGroup"...
  • Use this ID to configure openhab.cfg

Works flawlessly.

2 Likes

Hi Sebastian,
I am new to bots in telegram.i was able to add a bot to a group i have but i cant manage to get the group interact with the bot. i want the bot give buttons in the group chat so everyone can interact with . is this possible?
Gil - gillavon@gmail.com

I’m not aware that you cant tell openhab something via Telegram.
The addon is informational purpose only. Feeding messages to external rather than receiving messages and acting on those. Would be a great addition indeed.

Hi @waitz_sebastian thanks for this informations. i hope i am “allowed” to ask this here: i have successfully opended a Bot, and he sends me messages to my account. I created a group, i put the bot in, and activated him as admin.
But i am not sure where to configure this new chat group with the ID to my openhab2 via visual studio code. Do i have to put this chat id of the group additionally to the general telegram.cfg, or just in the rules using messages to this group?
I tried both, and nothing worked. :frowning:

Hey @EnergieS, You have to update your telegram.cfg in services folder. Just add the group as a second bot to “bots” variable which is comma separated.
Than than add a another chatID like this:

bots=chat1,chat2
chat1.chatId=123456
chat2.chatId=-987655
1 Like