# Help with how to create messages with \`inject\` node

**URL:** https://discourse.nodered.org/t/help-with-how-to-create-messages-with-inject-node/19564
**Category:** General
**Created:** [24 December 2019 23:00 UTC](https://discourse.nodered.org/t/help-with-how-to-create-messages-with-inject-node/19564 "2019-12-24T23:00:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [24 December 2019 23:00 UTC](https://discourse.nodered.org/t/help-with-how-to-create-messages-with-inject-node/19564/1 "2019-12-24T23:00:16Z")

</div>

Usually the `inject` node injects stuff in `msg.payload`.

You can edit the `topic` in another field.

Just because I want to optimise node usage:  
Is there a way to make the `inject` node send a `msg.flush` message?

I'm guessing it uses the `{ }` option.

In a `function` node, it is this:

```auto
msg = {
    'flush':'blah'
};

```

But I am not getting how to put that in the `inject` node.

Please.

---

<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: [24 December 2019 23:03 UTC](https://discourse.nodered.org/t/help-with-how-to-create-messages-with-inject-node/19564/2 "2019-12-24T23:03:42Z")

</div>

No. The Inject node can only set payload and/or topic.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [24 December 2019 23:05 UTC](https://discourse.nodered.org/t/help-with-how-to-create-messages-with-inject-node/19564/3 "2019-12-24T23:05:14Z")

</div>

On that, it is the `delay` node which has caught my interest.

It says if I inject a `flush` all messages will be flushed.  
To me that means they are forgotten.

(Nic, I saw your reply come in. I'll read it after posting this)

This flow is basically what I want done.

I press the `message` node. It is delayed 5 seconds.

But as I see it, if I press the `flush` button the node should be flushed.

I still get the message.

Why?

Ah! I need to send a `reset` message too.

My bad.

Post left to help anyone else who may fall for that trap.

```auto
[{"id":"a705a461.d8d19","type":"delay","z":"55b8031d.59ac1c","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":540,"y":1170,"wires":[["d29665c1.ae2cc8"]]},{"id":"cadeead6.dd7c","type":"function","z":"55b8031d.59ac1c","name":"","func":"msg = {\n 'flush':'blah'\n};\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":1100,"wires":[["9d2a6c18.b30bb","a705a461.d8d19"]]},{"id":"8355c78a.e3e6a8","type":"inject","z":"55b8031d.59ac1c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":240,"y":1100,"wires":[["cadeead6.dd7c"]]},{"id":"9d2a6c18.b30bb","type":"debug","z":"55b8031d.59ac1c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":550,"y":1100,"wires":[]},{"id":"2cddc0a9.e6c208","type":"inject","z":"55b8031d.59ac1c","name":"","topic":"","payload":"Message","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":1170,"wires":[["a705a461.d8d19"]]},{"id":"d29665c1.ae2cc8","type":"debug","z":"55b8031d.59ac1c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":700,"y":1170,"wires":[]}]

```

---

<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: [24 December 2019 23:27 UTC](https://discourse.nodered.org/t/help-with-how-to-create-messages-with-inject-node/19564/4 "2019-12-24T23:27:21Z")

</div>

No  
Reset will reset the node. I.E. forget everything (which is what you want.)  
Flush will send everything stored up immediately (like unblocking/flushing a pipe)

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [24 December 2019 23:30 UTC](https://discourse.nodered.org/t/help-with-how-to-create-messages-with-inject-node/19564/5 "2019-12-24T23:30:11Z")

</div>

My bad.

I tripped on that. I read it and mis-parsed it.

~~What I think it was is I am using some `trigger` and some `delay` nodes.~~~~ In the `trigger` node `reset` clears all messages. In the `delay` node `reset` . . . . I'm confused. I'll shut up.~~

All working now.

Thanks.
