# Pass a payload via the status framework

**URL:** https://discourse.nodered.org/t/pass-a-payload-via-the-status-framework/75587
**Category:** Feature Requests
**Created:** [22 February 2023 13:50 UTC](https://discourse.nodered.org/t/pass-a-payload-via-the-status-framework/75587 "2023-02-22T13:50:45Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ThorbenJ](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/thorbenj/32/76548_2.png) [@ThorbenJ](https://discourse.nodered.org/u/ThorbenJ)
#### Post date: [22 February 2023 13:50 UTC](https://discourse.nodered.org/t/pass-a-payload-via-the-status-framework/75587/1 "2023-02-22T13:50:45Z")

</div>

Hi.

I've created some nodes that provide detailed status information via a second output. However it seemed to me that it might be nicer if I used the existing status framework:

```auto
this.status({fill:"red",shape:"ring",text:"disconnected"});
this.status({fill:"green",shape:"dot",text:"connected"});

```

and the `status` node under node-red.

The problem is, it does not seem to be possible to pass any extra information.

I thought it might nice if `this.status()` had an optional second argument `payload`, and the `status` node would then place that in `msg.payload`.

Where `error` is the error object of some operation:

```auto
this.status(
  {fill:"red",shape:"ring",text:"authentication failed"},
  {info:"further operation details",error:error}
);

```

The `status` node could then emit:

```auto
{
  status:{ text:"authentication failed", source:{ type: "", id: "", name: "" }
  payload:{ info: "further operation details", error: {...} }
}

```

The graphical part of the status feature would ignore payload - this would be just a way to pass information from the source node to any attached status nodes.

I did try to search this forum, and I did not see anything that appeared to have discussed this. Also it appears feature requests are not welcome via GH issues.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [22 February 2023 14:45 UTC](https://discourse.nodered.org/t/pass-a-payload-via-the-status-framework/75587/2 "2023-02-22T14:45:53Z")

</div>

Hi @ThorbenJ

thanks for raising this.

I seem to remember there was a previous conversation around being able to include more properties in the status object. Although I don't believe it resulted in anything being done.

Without finding that discussion, and not remembering the specifics of what was said at the time, I suggest an approach that is consistent with the `node.error(...)` api; accept an optional second argument to be a full `msg` object that gets sent by the Status node (with the `msg.status` property added).

I think that would be clearer and not limit to just setting `msg.payload`.

If that sounds sensible (@dceejay) we can raise an issue to get it onto the backlog to get done.

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [22 February 2023 16:47 UTC](https://discourse.nodered.org/t/pass-a-payload-via-the-status-framework/75587/3 "2023-02-22T16:47:47Z")

</div>

Would the message then both go to status and catch ?  
I would expect an "error" to be catched by the catch node.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [22 February 2023 17:10 UTC](https://discourse.nodered.org/t/pass-a-payload-via-the-status-framework/75587/4 "2023-02-22T17:10:24Z")

</div>

Hi @bakman2

Perhaps I wasn't as clear as I could be. I'm am only suggesting that the style of the `node.status()` api be consistent with the `node.error()` api in terms of being able to provide a message to be sent.

I am _not_ saying that `node.error()` should do anything with the Status node, nor the other way around.

---

<div class="post-metadata">

### Author: ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)
#### Post date: [22 February 2023 19:27 UTC](https://discourse.nodered.org/t/pass-a-payload-via-the-status-framework/75587/5 "2023-02-22T19:27:59Z")

</div>

I have a mild objection to this. Consistency with the `node.error()` API is reasonable, but I have some concern that `node.status()` could be (ab)used to create invisible ("wireless") communication between nodes for all sorts of messages, something we have discussed in the past. Granted, `node.error()` probably could be used in the same way, and we haven't yet seen much of that. At the very least, the documentation should say a few words to discourage the practice.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [22 February 2023 19:56 UTC](https://discourse.nodered.org/t/pass-a-payload-via-the-status-framework/75587/6 "2023-02-22T19:56:20Z")

</div>

Not sure why it would be any more abused than node.error - It would be caught by status nodes so I suppose it could but seems rather clunky as the status node wouldn't just pass on that msg - it would be a sub-property. I thin kaligning it with node.error api makes sense.

Just need to make sure the extra msg part doesn't get sent to the editor.

---

<div class="post-metadata">

### Author: ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)
#### Post date: [22 February 2023 22:50 UTC](https://discourse.nodered.org/t/pass-a-payload-via-the-status-framework/75587/7 "2023-02-22T22:50:31Z")

</div>

> [@dceejay](#):
>
> as the status node wouldn't just pass on that msg - it would be a sub-property.

Almost, but not quite. This flow passes the incoming payload to the output of the `catch` node with no fuss.

```auto
[{"id":"a9afe08da7ef07c6","type":"function","z":"424965709c0ff25f","name":"","func":"node.error(\"my error message\", msg);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":140,"wires":[[]]},{"id":"d56b8d3149b0de81","type":"catch","z":"424965709c0ff25f","name":"","scope":["a9afe08da7ef07c6"],"uncaught":false,"x":450,"y":200,"wires":[["ffdb1a878615d90c"]]},{"id":"ffdb1a878615d90c","type":"debug","z":"424965709c0ff25f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":610,"y":200,"wires":[]},{"id":"ad5721bf5c957463","type":"inject","z":"424965709c0ff25f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":300,"y":140,"wires":[["a9afe08da7ef07c6"]]}]

```

Not a big deal, but still interesting. I assume the modified `node.status()` and `status` node would do the same.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [23 April 2023 22:51 UTC](https://discourse.nodered.org/t/pass-a-payload-via-the-status-framework/75587/8 "2023-04-23T22:51:13Z")

</div>

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