Data Templates in Service Calls

I’m trying to convert my traditional automations over to Node-Red, including some actionable ios notifications, but have gotten stuck when it comes to the data_template I use to call up the notification. If I put a call service node with the data field filled with the following:

{
  "data_template": {
    "title": "Garage Open for 5 Minutes",
    "message": "What would you like to do?",
    "data": {
      "push": {
        "category": "garageactions"
      }
    }
  }
}

I am not getting any sort of notification on my phone when the flow is triggered. The debug output I see is:

msg.payload : Object
object
domain: "notify"
service: "ios_kevins_iphone_x"
data: object
data_template: object
title: "Garage Open for 5 Minutes"
message: "What would you like to do?"
data: object
push: object
category: "garageactions"

How do I correctly pass along the data template to my notify.ios service call?

Figured it out on my own. Used the function node with the following json:

msg.payload =
{
    "data": {
        "title": "Garage Open for 5 Minutes",
        "message": "What would you like to do?",
        "data": {
          "push": {
          "category": "garageactions"
        }
      }
    }
}
return msg;

And left empty mustache braces {} in the Data portion of the notify.ios call

4 Likes

So how would I send an image from one of my cameras? Where in the function node would I put:

url: 'https://Fake_HA_Server.duckdns.org:8123/api/camera_proxy/camera.front_door?api_password=notMyPassword'

I just cannot get the formatting right.