# Insert payload into message

**URL:** https://discourse.nodered.org/t/insert-payload-into-message/71441
**Category:** General
**Tags:** function-node
**Created:** [29 November 2022 11:36 UTC](https://discourse.nodered.org/t/insert-payload-into-message/71441 "2022-11-29T11:36:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kirelam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kirelam/32/64294_2.png) [@kirelam](https://discourse.nodered.org/u/kirelam)
#### Post date: [29 November 2022 11:36 UTC](https://discourse.nodered.org/t/insert-payload-into-message/71441/1 "2022-11-29T11:36:33Z")

</div>

Dear Nodes,

Can somebody assist me, in how to create a message, where a payload value in is inserted.  
Goal is to create a message for Telegram, where the name of a specifik smoke alert is inserted into  
a sentence, wich will be send to Telegram

Kind regards,  
Eric

 ![Node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/a/2a882405d9dc691ce9e74cee1af9d0d062051091.jpeg)

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [29 November 2022 11:42 UTC](https://discourse.nodered.org/t/insert-payload-into-message/71441/2 "2022-11-29T11:42:19Z")

</div>

in a `function` node...

```auto
msg.payload = `There is a fire in ${msg.payload}`
return msg

```

or

```auto
msg.payload = {
  "original_payload": msg.payload,
  "message": "There is a fire"
}
return msg

```

or

```auto
const origPayload = msg.payload
msg.payload = {}
msg.payload.message = "there is a fire"
msg.payload.data = origPayload
return msg

```

If you want more relevant advice, please provide more detail of how you want the `msg` to look and what it will contain. Provide details of what the input looks like and when it should be considered a "smoke alert"

---

<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: [28 January 2023 11:42 UTC](https://discourse.nodered.org/t/insert-payload-into-message/71441/3 "2023-01-28T11:42:40Z")

</div>

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