Help with simplification of Node Red Mobile App Notifications

Recently I changed my mobile device I was using for mobile app notifications and I found that manually going through and updating all of the call service nodes for the various notifications I have is not fun. So that got me thinking there has to be a better way to do this. I came up with the idea to use change nodes to set the various message parameters and then use a link out nodes for the various notifications I have to send it to one link in node. That node would pass it along to one call service node for notifications for my mobile device using the message parameters it’s passed for the specifics of the notification. That way if I change devices again I only have one node to change.

Here’s the change node I was testing with.

The output of this is passed to a call service node for home assistant (domain: notify, service: mobile_app_specific_device). With the following JSON for the Data portion of the call service node.

Now when I test this, the message and title of the notification matches what I set via the change node. However, the image from the url I set via the change node is not included in the notification. If I replace {{imageurl}} in the Data portion with the same url I’m setting via the change node (using the real one and not the fake one I included in the screenshots), the picture is included with the notification. Any ideas why I’m not able to specify the image using {{imageurl}}? Does anyone have a better way to do this?

1 Like

This is an really clever way how you managed the notification, i rely for all my notifications heavily on this post, and it works really well🤗 perhaps you find some ideas there

Thanks for the link. That started me off on another path of google searches and I figured it out. I stumbled upon this page which pointed out the following.

By default, Mustache will replace certain characters with their HTML escape codes. To stop this happening, you can use triple braces: {{{payload}}} .

So all I ended up needing to do was change “{{imageurl}}” to “{{{imageurl}}}” to stop it from replacing certain characters (I’m guessing it was the “/”'s) with the HTML escape codes. Once I did this my image started showing up.

1 Like