Telegram to iOS

Could any Telegram users tell me if this is feasible with Telegram?
I don't use Telegram, but if it is possible, I'll dive straight in, read the docs, install the app & node and develop a flow.

  • I want to send a push message from node-RED to my wife's iphone/ipad reminding her to take her medication (it's not taken regularly - it's by criteria which I can format in node-RED).
  • The message should have a 'OK' button so that she can acknowledge the message (without having to open up an app or mess about!).
  • The acknowledgement is then sent back to node-RED.
  • If no acknowledgement is received in say 5 minutes, then a push message is sent to my phone.

I'm OK developing the flow, it's mainly about whether Telegram is capable of doing this.

This is just a feasibility question, but as always, any hints or tips appreciated.

1 Like

Hi Paul, sounds to me that’s possible. I’ve a similar setup here, with cron-plus outputting the message text and what type of medication. What you need to do while creating this is saving the so called chatId (the unique identifier that specifies the chat between your wife’s telegram account and your bot) in the context so that it can send messages without the need to respond to incoming messages. Telegram allows to have specific buttons to be present at messages it sends, and can parse those on getting pressed. Depending on the telegram nodes you use it might allow responding messages with X timeout to be passed to the output, otherwise a timer of a type is needed.

After typing this all I realise there’s one caveat I do not know the answer to. I have telegram only in use for “beta” flows, and it’s been a while since I used the buttons in bot messages. As a result I do not know whether the button is present in the push notification. For my medication flow I use the iOS app Pushcut, which is used to trigger push notifications on iOS devices. These notifications can have actions added to it, which I think corresponds to your specific scenario of not opening any app at all. These actions can also be urls that have to be targeted, meaning if you add an endpoint to hour flow for acknowledgement. If I remember correctly you have an oracle based cloud setup, meaning you can securely set this up quite easily. I have it set up with a tiny web server on a cloud instance that also runs a secured mqtt server and publishes incoming request bodies to a specified topic, which my NR instance deeply behind NAT then subscribes to. If your setup is the way I remember it to be, you won’t need that middleware proxying over mqtt and can connect it directly. I think this entire set up should work on the free plan of pushcut too, but I’m not entirely sure. Publishing notifications to pushcut is as simple as a single http request node in your flow, by the way.

1 Like

Thanks for that Lena, I had a look at Pushcut earlier but hit a few problems. The first is that as I have secured node-RED, auth is required to access the endpoint. I realise that there are ways around that, but the second problem is that when using a webhook in Pushcut, I kept getting a popup asking me to signup to a paid plan.

I did also try Telegram, and after a few failures, I managed to get node-RED talking and listening to the Telegram iOS app. However, I can't see how a button can be added to the popup.
I seem to remember @TotallyInformation mentioning something about buttons or links some time ago, but can't find it. Maybe I'm mistaken.

1 Like

Yeah, that’s an issue. I’m on the paid plan but I use it for a lot more than just these, and so far that seems a worthwhile investment but we’ll see if that continues :slight_smile:

As for buttons and links, I think those are in-app, not on the notification but I’m not sure there :frowning:

For my pushcut background request as action I’m sending custom headers with an auth token along, which is verified at the web endpoint of my mqtt-web-proxy. Think of it as a poor man’s CSRF approach. I think you could solve this too by setting the auth header to basic with a base64 encoded string, but afaik that’s also on the paid plan. I contacted the developer last week and had dynamic headers for action requests added to the API, so now I should be able to cycle the tokens if needed.

1 Like

No, you are correct. They are referred to as "keyboards" in Telegram and there are 2 types.

Thanks. I haven't managed to apply keyboards just yet, but I'm in consultation with the Botfather...

1 Like

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