Telegram bot chat - add a friend

Hi there, I sucessfully used node-red-contrib-telegrambot with a bot created via BotFather, to send and receive messages. So usually I send texts that are interpreted as commands and I generate answers using the initial ChatID.

Now I "just" want to enable a friend that uses Telegram too, to do just the same instead me - so how to get this easiest - is it something I or he need to do in Telegram or in node-red?

So far i have a function to fill the answer like

var as=global.get('Alarm');
let payload = {
    "content": "Status "+n+":\n\nAlarm="+as"
return {payload};

that goes to the telegram sender node..

You may want to create a Telegram group and join to this group your new bot and your friend. As a second step send a message to the group. Now you have to find what is the chatid of the group you just created. You can do that by entering the following URL in your browser: here theToken of your bot - without the parenthesis)/getUpdates

You will get in your browser a JSON object that has inside a chatID with a negative sign. A fake example below.

1 Like

Hmm.. I get


maybe I misunderstood.. ?

This happens when there is no message in the group. Sometimes you have to try twice or three times.

Instead of a group, you could also get your friend to add your bot to their account - then they can do the same as you. In Node-RED you would see messages from a different chatid.

But a group works as well, but really that is for if you want both of you to see the inputs and outputs.

Hmm.. I did it a lot of times now sending messages .. but no luck. Any other chance to get the group chat ID?

@TotallyInformation: Yes indeed I would like to be able to see all send receive everywhere

I don´t know other alternative to get the chatID. Just to double check. You have sent messages from your Telegram user to the new group, right ?

Edit: a good reference:

yes, also my friend did so and I see his messages in the group, but not with "getUpdates" - maybe my phone eats the update before I can hit F5 in the browser?

interesting, there is one comment with the same issue - will test tomorrow to remove and re-insert the bot to the group

Just to let you know: removing and re-joining the bot from the chat solved the issue, as well as renaming the group worked for me. All fine now.


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