# Help to know telegram chat ID

**URL:** <https://discourse.nodered.org/t/help-to-know-telegram-chat-id/55918>\
**Category:** General\
**Created:** [31 December 2021 03:35 UTC](https://discourse.nodered.org/t/help-to-know-telegram-chat-id/55918 "2021-12-31T03:35:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlorenzo](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@dlorenzo](https://discourse.nodered.org/u/dlorenzo)\
**Post date:** [31 December 2021 03:35 UTC](https://discourse.nodered.org/t/help-to-know-telegram-chat-id/55918/1 "2021-12-31T03:35:03Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [31 December 2021 12:19 UTC](https://discourse.nodered.org/t/help-to-know-telegram-chat-id/55918/2 "2021-12-31T12:19:06Z")

</div>

> [@dlorenzo](#):
>
> [https://api.telegram.org/bot/getUpdates](https://api.telegram.org/bot/getUpdates)

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.

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [31 December 2021 12:29 UTC](https://discourse.nodered.org/t/help-to-know-telegram-chat-id/55918/3 "2021-12-31T12:29:16Z")

</div>

> [@dlorenzo](#):
>
> The method using  
> [https://api.telegram.org/bot/getUpdates](https://api.telegram.org/bot/getUpdates)  
> never worked for me.

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)

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

```

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

---

<div class="post-metadata">

**Author:** ![dlorenzo](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@dlorenzo](https://discourse.nodered.org/u/dlorenzo)\
**Post date:** [31 December 2021 12:55 UTC](https://discourse.nodered.org/t/help-to-know-telegram-chat-id/55918/4 "2021-12-31T12:55:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dlorenzo](https://avatars.discourse-cdn.com/v4/letter/d/b19c9b/32.png) [@dlorenzo](https://discourse.nodered.org/u/dlorenzo)\
**Post date:** [31 December 2021 13:02 UTC](https://discourse.nodered.org/t/help-to-know-telegram-chat-id/55918/5 "2021-12-31T13:02:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [14 January 2022 13:02 UTC](https://discourse.nodered.org/t/help-to-know-telegram-chat-id/55918/6 "2022-01-14T13:02:55Z")

</div>

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