Help to know telegram chat ID

Hi friends.
I'm using NR v 2.1.3 with node-red-contrib-telegrambot, and need to know the chat ID of the group I'm using with NR.
Two weeks ago I found a way using "telegram receiver" node. I just need to post something in the telegram group where my bot was included as administrator and in debug window appeared the group ID.
But today I tried to do the same thing and don't remember how. And can't find the link with the trick.
The method using
https://api.telegram.org/bot/getUpdates
never worked for me.
The solution for my problem was using "telegram receiver" node, but I'm confused and don't remember how.
Could you please help me?
Many thanks in advance.
Regards
DL

That isn't correct, it is: https://api.telegram.org/bot<YourBOTToken>/getUpdates

The trick is to add the bot to a group. Then you should be able to get updates back using the nodes in any case and the chatid is in the data just send it to a debug node set to show the whole msg.

1 Like

Same for me until I realized it was a bad idea adding the Telegram token to Node-RED too soon. This should be done in a later step.

I wrote below recipe several months ago as a workable solution. I have not created any bot recently so perhaps there is a better way to capture the bot id.

1- Create a new Telegram bot and take note of the TOKEN
2- Add the bot to a Telegram group
3- Send a message from the group to the bot
4- Enter a URL in the browser with bellow pattern and look for the "negative id" (replacing the word TOKEN by the token you got in the previous steps - but keep the letters "bot" in front of the TOKEN)

https://api.telegram.org/botTOKEN/getUpdates

5- Only now add the TOKEN to Node-RED node.

Hi friends. Many thanks for your responses.
@TotallyInformation: yes, I tried that method with the right address. Never worked as said by Andrei. When I posted in NR forum, the address was deleted in the bot code.
@Andrei: I'll try your method. Thank you

Wel, I tried again in another flow I have and the method with node and debug worked. I don't know why I'm not getting debug messages in one flow, including telegram nodes one.
Thanks for your help.
I prefer this method over working with telegram api, because it never worked for me.
Regards
DL

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