HTTP POST & flow variables

Hi -

I am trying to use a flow variable in a Node Red - Function that will send the data as a payload to a POST Http request.

I am querying one API and then saving the values for key data to flow variables, then using another product API to upload the data.

This is a copy of the function I have built, but the SleepScore Variable is not working in the downstream API, what do i have wrong?? When I use a static 2.5 values as in the others it works

const SleepScore = flow.get("SleepScore");
var outputMessage = {
    _msgid: msg._msgid,
    payload: {
        "parent": { "database_id": "185--------------------080c" },
          "icon": {
  	"emoji": "šŸ„¬"
  },
	"properties": {
		"Name": {
			"title": [
				{
					"text": {
						"content": "Title Goes Here"
					}
				}
			]
		},

        		"Sleep": { "number": SleepScore },
        		"Activity": { "number": 2.5 } ,
        		"Readiness": { "number": 2.5 }, }
}
}
return outputMessage;

What does a debug node after the function node show?

What is the value contained in the flow context, you can see it in the sidebar under context, hit refresh to see updated values.

More than your function code info is required to see what may be happening.

Use node.warn({SleepScore}) in your function to see the values in the sidebar debug panel.

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