# Is it possible to receive data from the chat (group or private) telegram?

**URL:** <https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839>\
**Category:** General\
**Created:** [11 February 2021 23:06 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839 "2021-02-11T23:06:53Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![fzr91](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@fzr91](https://discourse.nodered.org/u/fzr91)\
**Post date:** [11 February 2021 23:06 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839/1 "2021-02-11T23:06:54Z")

</div>

I tried telegram bot to receive data from a private and group chat but I don't get anything, I can only interpret the data from the bot I created but not within the chat. Am I wrong or is it not possible?

---

<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:** [11 February 2021 23:22 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839/2 "2021-02-11T23:22:57Z")

</div>

Sorry, not quite clear what your issue is. Certainly you can get information to your bot in a group chat or in a 1:1 chat.

---

<div class="post-metadata">

**Author:** ![fzr91](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@fzr91](https://discourse.nodered.org/u/fzr91)\
**Post date:** [11 February 2021 23:29 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839/3 "2021-02-11T23:29:02Z")

</div>

I try to explain myself better: I'm interested in knowing if this contrib [node-red-contrib-telegrambot (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-telegrambot), (or similar) receives data only from the bot telegram or also from the group or private chat of telegram, since I do not receive them in chat, instead with the bot I have no problems I receive and send data

---

<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:** [12 February 2021 19:51 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839/4 "2021-02-12T19:51:39Z")

</div>

It only receives from the bot. In the group, a group user needs to interact with the bot.

However, you can also have the bot listen to all messages in a group. Then everything that happens in the group will appear as an inbound msg.

The one limitation is that you cannot have 2 bots in a group talking to each other. If one bot posts to a group, the other bot cannot receive that message.

---

<div class="post-metadata">

**Author:** ![fzr91](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@fzr91](https://discourse.nodered.org/u/fzr91)\
**Post date:** [15 February 2021 02:56 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839/5 "2021-02-15T02:56:51Z")

</div>

> [@TotallyInformation](#):
>
> However, you can also have the bot listen to all messages in a group. Then everything that happens in the group will appear as an inbound msg.

That's exactly what I need but how should it be configured? I added user (with or without @) and ChatIds in nodered bot configuration, but nothing happens  
My configuratios:

 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/a/5ac247a1aa27ed625bf8376eeb3229137d1b081a.jpeg)

If I use : [https://api.telegram.org/bot1630910881:AAF-ovtOhFzZPLCqwHBW7jpJYOEphdVt3Ug/sendMessage?chat\_id=-597556680&text=test](https://api.telegram.org/bot1630910881:AAF-ovtOhFzZPLCqwHBW7jpJYOEphdVt3Ug/sendMessage?chat_id=-597556680&text=test)  
the message appears correctly in telegram but nodered does not receive any message

---

<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:** [15 February 2021 12:11 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839/6 "2021-02-15T12:11:05Z")

</div>

If you go into your group, click on the icon to get into the groups config. Then you can see who is a member of the group. Check if the bot has access to messages - if it doesn't it can only receive `/` commands, you need to change the bot's privacy settings for the group using the BotFather group.

Details here: [How to receive messages in group chats using telegram bot api - Stack Overflow](https://stackoverflow.com/questions/38565952/how-to-receive-messages-in-group-chats-using-telegram-bot-api) - if privacy is set to `enabled`, only `/` commands will get to the bot, if disabled, all messages can get to it.

Note that all bots in the group will get commands and/or messages and all can respond.

To respond to a message/command, in Node-RED add a telegram receiver node then optionally a switch to filter out what you want to respond to, a simple response could simply replace the msg.payload.content of the incoming msg and then send to a telegram sender node.

For more complex responses, try using the RiveScript contrib node or maybe a custom function.

Here are some examples I have in my setup:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/2/424f64b63783782e9a0fd277dbba70c744b37b26.png)

The link nodes all go back to a single sender.

Here is an older config using RiveScript to allow for a more conversational interaction:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/15dacd44c965628351ad0aac3298f3221299ada9.png)

Output on this one goes via MQTT.

---

<div class="post-metadata">

**Author:** ![fzr91](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@fzr91](https://discourse.nodered.org/u/fzr91)\
**Post date:** [15 February 2021 20:37 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839/7 "2021-02-15T20:37:55Z")

</div>

First of all thank you for the suggestions, I have configured the privacy and group messages are now active but unfortunately nodered receives data from the chat app only and not from the api command line, I have to use a shortcut of siri to give the commands and so it is unusable, I will look for some alternative, thank you very much anyway 😉 👍

---

<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:** [16 February 2021 11:32 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839/8 "2021-02-16T11:32:22Z")

</div>

> [@fzr91](#):
>
> not from the api command line

I don't understand. That's the first time you've mentioned that. Which API and how are you using it?

The issue I think you have is that bots cannot interact with other bots. If you are using Apple Shortcuts, I think that Telegram treats any interactions like another bot. There is an outstanding enhancement request [iOS 12 Shortcuts and iOS URL Scheme support · Issue #309 · peter-iakovlev/Telegram (github.com)](https://github.com/peter-iakovlev/Telegram/issues/309).

Apple iOS is not good at these kinds of complex interactions.

---

<div class="post-metadata">

**Author:** ![fzr91](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@fzr91](https://discourse.nodered.org/u/fzr91)\
**Post date:** [17 February 2021 02:34 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839/9 "2021-02-17T02:34:22Z")

</div>

> [@TotallyInformation](#):
>
> I don't understand. That's the first time you've mentioned that. Which API and how are you using it?

You probably didn't notice but the link I showed you, used the "telegram bot api". 😉

 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/7/47fb070ff1063deb02573653ebfb50f453e2b328.png)  
Anyway I would have liked to activate a gpio from siri,someone had suggested telegram but probably it is not the most suitable method 🤷‍♂️

---

<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:** [18 April 2021 02:34 UTC](https://discourse.nodered.org/t/is-it-possible-to-receive-data-from-the-chat-group-or-private-telegram/40839/10 "2021-04-18T02:34:56Z")

</div>

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