Is it possible to set multiple chat ID for one Bot?

Hi,
Until now I had only one device, for tessting the messaging system. Everything works fine. :slight_smile:
My wife installed telegram and managed to finde our house bots. I do have a admin bot where I get more informations pushed and one house bot where very importanat and user relevant push are beeing pushed.

So I wanted to add the chat id of my wifes account to the telegram.cfg but I don’t know how to add an aditionanal chat ID in the same bot.

bots=bot1,bot2

bot1.chatId=xxxxxxx
bot1.token=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

bot2.chatId=xxxxxxx
bot2.token=yyyyyyyyyyyyyyyyyyyyyyyyyyyyy

I could create a third bot and this would work, but I don’t want to do that. Otherwise I have to change all my push scripts.

Thanks for the help

I think you need to use/setup a group chat for telegram actions.
extract from Telegram - Actions | openHAB

That is the chatId. Note that if using a Telegram group chat, the group chatIds are prefixed with a dash that must be included in the config file. (e.g. bot1.chatId: -22334455)

In definition of telegram binding ( Telegram - Bindings | openHAB ) either group chats or comma separated list of chat ids can be used.

I don’t know how group works. I just use telegram for push in openhab.
I’m also a bit worried about privacy and that others could get my pushes.

I tried with comma but it did not work.

bots=bot1,bot2

bot1.chatId=xxxxxxx,aaaaaaaaa
bot1.token=zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

comma separated list does not work with the telegram action service - only with the telegram binding.

With regard on how to setup/manage groups you may have a look at:

My 5 cents, I suggest to migrate to the v2 binding instead using the v1 telegram action.

I didn’t know about the binding I used action.
So now I deleted the telegram action and installed the telegram binding.

I don’t know where I do have to configure my chatid and my token.
In the manual they don’t talk about PaperUI and configuration there. So I assume that I have to Install the Binding and then do all configuration in Visual Studio Code and create a new file called telegram.things.

Is this right?

no. do it via paperui. inbox -> + sign -> select telegram and follow the steps there

okay thanks, I will do that and then change all push I’ve already did on action. I might have some more questions thene :wink:

But thanks anyway for the greate support

I do have a question about the rule action “telegramAction”

Can I use a couple of rules with the same “telegramAction” name or do I have to chage the valu name for each new rule?

Hope this is clear enough.

Instead of having the line
val telegramActiont = getActions(“telegram”,“telegram:telegramBot:xxyyzz”)

in each rule separatly, like this
[
val telegramAction = getActions(“telegram”,“telegram:telegramBot:xxyyzz”)
telegramAction.sendTelegram(“Blablabla”)
]

I placed it at the top of the rule file and then on each rule I have only one line
[
telegramAction.sendTelegram(“Blablabla”)
]

But I think this is wrong.
What is the diference to have it in the rule code and to have it at the top of the file once?

In the maual it is on each rule. But I wanted to save time by using only one “val telegramAction =”

I can’t describe it right.
musst this telegramAction be a unique name or do I have to change it in ev ery rule?

According to [SOLVED] Variable and rules I would say it should work with a global definition within one rule file.

in the meantime you might already have finished editing your file …?

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.