Telegram post caption filter

Hi, I state that my level is basic.
I would like to filter the content of a channel by a keyword in the caption and then forward it to a second channel.
i use contrib telegram nodes, and have tried with switch nodes to no avail.

what solution can i adopt?

Welcome to the forum @gleba.

Have you started by making sure you can (a) get the messages from the first channel and output to the debug panel, and (b) send a message to channel 2?

Yes. Currently I forward all messages, but I'm only interested in one that in the caption starts with #

You can use a switch node to only pass the ones you want. If it doesn't work then show us what the message looks like and how you have configured the switch.

I have already tried with the node of Switch, But surely wrong configuration. I set msg.payload.caption and in the filters contains string key words. As a second filter I put otherwise. I always get the second exit.
As soon as possible post photos.

If you want to test for the caption starting with # then use Matches regex and for the regex use ^#
^ matches the start of the string, so that will find any strings where the first character is #

I did a test but posting a photo with and without caption containing # I always get the exit. 2.

Perhaps payload.caption isn't what you expect it to be. The test below works.

EDIT: I just notice you wrote "caption containing #'. The '^#' regex looks for strings starting with '#'. If you want '#' to be anywhere within the caption, use a regex of just '#' (or indeed use 'contains' rather than 'matches regex').

I don't see caption in the debug node output, if you click on the debug output it will expand so you can see what is there.

This is the caption used.

I tried to run the test but in both cases it has always been output 2

Isn't that msg.originalMessage.caption? Or

If you use the copy path button next to the caption property, you will find the path is
The copy path button appears when you hover the mouse to the right of the property in the debug panel.
so it should be msg.originalMessgae.caption

@jbudd photo is an array with 3 items not 4.

Yes, it is. I was peering myopically at my phone screen! :face_with_monocle:

Thanks it worked and now I can filter the content of the captions.

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