# Inject node to a function node

**URL:** <https://discourse.nodered.org/t/inject-node-to-a-function-node/48496>\
**Category:** General\
**Created:** [16 July 2021 14:24 UTC](https://discourse.nodered.org/t/inject-node-to-a-function-node/48496 "2021-07-16T14:24:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpbillund](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tpbillund/32/37410_2.png) [@tpbillund](https://discourse.nodered.org/u/tpbillund)\
**Post date:** [16 July 2021 14:24 UTC](https://discourse.nodered.org/t/inject-node-to-a-function-node/48496/1 "2021-07-16T14:24:58Z")

</div>

Hi

I have this inject node, and works well.  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/a/cad5f6cff4dfbf8f37b06401b6c2d303fd4471da.png)

How do I make a msg.topic and msg.payload function, so it will work as the inject 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:** [16 July 2021 14:28 UTC](https://discourse.nodered.org/t/inject-node-to-a-function-node/48496/2 "2021-07-16T14:28:36Z")

</div>

The equivalent Function node would be:

```auto
msg.payload = {
   "warning": { ... }
}
msg.topic = "zigbee2mqtt/R_Alarm_Køkken/set"
return msg

```

---

<div class="post-metadata">

**Author:** ![tpbillund](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tpbillund/32/37410_2.png) [@tpbillund](https://discourse.nodered.org/u/tpbillund)\
**Post date:** [16 July 2021 14:30 UTC](https://discourse.nodered.org/t/inject-node-to-a-function-node/48496/3 "2021-07-16T14:30:43Z")

</div>

Hi knolleary  
And then after the question, then I found [Sending value from array to mqtt in nodered](https://stackoverflow.com/questions/66227926/sending-value-from-array-to-mqtt-in-nodered)

But can see that it's almost the same as you wrote.

Thx alot. 🙂

---

<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:** [30 July 2021 14:30 UTC](https://discourse.nodered.org/t/inject-node-to-a-function-node/48496/4 "2021-07-30T14:30:45Z")

</div>

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