Node red notification not working correct

Hi, i have made an flow that i want to use that the train has an delay or is on time. But i want add the wheater temperature. i have made an function node with some javascript. i want to retrieve the whole msg in my message. I hope someone can help me.

here is my flow:

[{"id":"29abe4afdf2e5645","type":"api-call-service","z":"eff08008135be678","name":"Notify mobile","server":"2ac5e9467e57d943","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_iphone_van_willem","areaId":[],"deviceId":[],"entityId":[],"data":"{\t    \"message\":  & msg.payload}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1130,"y":300,"wires":[["797e77afcb16f5fe"]]},{"id":"2ac5e9467e57d943","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":": ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"default","statusTimeFormat":"h:m","enableGlobalContextStore":false}]

Your call service node currently has the following in the data field:

{
    "message":  & msg.payload}

This has two problems - only one of which is breaking it though.

Using Jsonata, you don’t specify msg.. If you use it, you will see “compatibility mode enabled” (see below). If you click it, you will see an explanation.

image

But the real issue is the “&” doesn’t belong there. That would be used to concatenate two strings, so would expect a string to the left, which isn’t there.

I tried to set the payload in a variable like this: {{payload}} but then i get nothing notified.

You would either need the data type to be JSONata (image) and use:

{ "message": payload }

Or leverage HA templates on that node and set the data type to JSON (image) and use:

{ "message": {{payload}} }

I’ve never actually tried the second alternative, as I would just use JSONata because that’s what’s used elsewhere in NR.

Having said that, I always set msg.payload.data in a previous node so I can choose to also put in a debug node to see I’m actually getting what I want.