Using Node-RED to read from Telegram bot

Looking for some guidance, i installed the telegram node and i can see the message payload and view new messages as they come in.

how do i look within the message payload and look for #ERROR or #CLOSED then based on the condition call an appropriate service to run.

Figured i should be using a Switch Node and i tried setting conditions that contains text "test" but the debug doesnt show it exit the switch node...

Did you try it without the quotes ?

yes i did ....i tried with and without ...

The node that i am using is the Receiver Node that points to my telegram bot...and that seems to work and i can see the debug message show the entire message

adding the simple flow that i am using

Checking for text is without quotes.

Could you rephrase your question ?

So i have this Telegram Bot that writes lots of messages of its activities.

I am looking for specific messages that has withing the body "#ERROR" or "#COMPLETED" so that i can build an automation activity that lets me know either things are working well or do i need to go to my VPS to restart the BOT.

Hence i am using the nodered integration to read the messages then based on the TEXT found perform various home automation tasks.

The switch node does exactly this, did you try it ?

For some reason....like i had in my earlier screenshot...when i typed test into the bot chat i can see the debug message exit the Receiver Node

but no debug message after the Switch Node.

Ah i looked over it. In the switch node, instead of msg.payload, use msg.payload.content

Weird this message did not get sent out!

so yes that did work! however here is something interesting, when i Type "Test", it is picked up by NodeRed and the conditions are met.

however, when the Bot is the one that is posting into the Chat, NodeRed does not pick it up because i am guessing Telegram Bot messages are not msg.payload.content.....but something else....

Any thoughts?

That's what the debug node is for. Just set it to show the whole msg.

If it isn't coming in, it will most likely because you are trying to connect two bots and that doesn't work because otherwise you would be able to do a DOS attack on Telegram by creating a bot loop.

just clarifying ...and im a little new with this tool

Within the debug node, it forces me to at min have msg.payload and this comes up blank whenever the bot is the one that posts the message. if i type it works.

So my trading bot is what posts the messages..and its verbrose so i wanted to build an automation to pick up specifc trade closes...

Click on the dropdown for the output and you will see that you can choose to output the whole msg instead of just one property of it. :slight_smile:

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