How to define inputs for Telegram rule in experimental rules engine?

Hi,
Is there a way to define a text to go into a Telegram message in the experimental rule engine?
I’m not a developer, therefore using the scripts or coding rules directly isn’t working for me.

My Telegram binding definitely works because I did manage to code a basic message.
But now I’d like to define more sophisticated messages using the experimental engine based on other rules I have already defined there and put certain text into the messages.

Thanks, Christian

The answer is yes, but you will have to write the code to do it as a Script Action. You can never get away from having to write actual code at some point.

Assuming you are working in PaperUI and using the 2.x Telegram binding your Action would look something like:

var message = // code to build the message to send goes here
actions.get("telegram", "telegram:telegramBot:<uid>").sendTelegram(message)

You need to supply the code to build up the message string and use the UID from the Thing created to connect to Telegram.

1 Like

Thanks so much Rich! This works perfectly. And I know (and have to accept :wink: ) that I can only get that far without coding.
However, I don’t quite understand what the actions “Telegram Answer” and “Telegram message” are doing on its own then.

I don’t use this binding but from the docs Telegram Answer doesn’t do anything on it’s own. You have to all that after you’ve received a response from a Query (sendTelegramQuery). I don’t see Telegram Message anywhere in the docs, beyond the fact that sendTelegram sends a Telegram message.

1 Like

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