Try this example
[{"id":"b6aca93.d3504d8","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":1200,"wires":[["998e2ee1.065bc8"]]},{"id":"998e2ee1.065bc8","type":"switch","z":"d1395164b4eec73e","name":"","property":"stop_delay","propertyType":"flow","rules":[{"t":"istype","v":"undefined","vt":"undefined"},{"t":"else"}],"checkall":"false","repair":false,"outputs":2,"x":260,"y":1140,"wires":[["493b5acc.71c19c"],[]]},{"id":"493b5acc.71c19c","type":"trigger","z":"d1395164b4eec73e","name":"","op1":"","op2":"","op1type":"pay","op2type":"pay","duration":"30","extend":false,"overrideDelay":true,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":430,"y":1140,"wires":[["2d59e28837486a6c"],["e6b2b1f0.ada2b8"]]},{"id":"e6b2b1f0.ada2b8","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"delete","p":"stop_delay","pt":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":1180,"wires":[[]]},{"id":"2d59e28837486a6c","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"stop_delay","pt":"flow","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":1120,"wires":[["ae4ef9b4.4bd328"]]},{"id":"ae4ef9b4.4bd328","type":"debug","z":"d1395164b4eec73e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":1140,"wires":[]}]
Otherwise export your flow so we can see the inject values and your full function code. As your are not setting msg.payload and are returning node ( which you should not use as a function name, as already defined in the function node, therefore node.send would also return an error i believe), so payload would always be undefined. and sending input which should throw an error as input is not an object as far as i can see.
Also input looks to be undefined in your code.
How to import/export a flow
Set your debug to show complete message object, you will see what node returns.
In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```
) You can use the </>
icon to add the backticks.
```
code goes here
```
You can edit and correct your post by clicking the pencil icon.
See this post for more details - How to share code or flow json
[edit]
Thinking about it a simple rate limit and drop intermiedate messages should work to.
[{"id":"b6aca93.d3504d8","type":"inject","z":"d1395164b4eec73e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":1200,"wires":[["1a3ba0d64520256a"]]},{"id":"1a3ba0d64520256a","type":"delay","z":"d1395164b4eec73e","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"30","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"allowrate":false,"outputs":1,"x":480,"y":1180,"wires":[["ae4ef9b4.4bd328"]]},{"id":"ae4ef9b4.4bd328","type":"debug","z":"d1395164b4eec73e","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":870,"y":1140,"wires":[]}]