# Inserting characeter before payload is sent

**URL:** https://discourse.nodered.org/t/inserting-characeter-before-payload-is-sent/6075
**Category:** General
**Created:** [22 December 2018 22:40 UTC](https://discourse.nodered.org/t/inserting-characeter-before-payload-is-sent/6075 "2018-12-22T22:40:32Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![patrolin](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@patrolin](https://discourse.nodered.org/u/patrolin)
#### Post date: [22 December 2018 22:40 UTC](https://discourse.nodered.org/t/inserting-characeter-before-payload-is-sent/6075/1 "2018-12-22T22:40:32Z")

</div>

just wondering if anyone can point me in the right direction, all i want to do is use the color picker to give me the hex value but i want to add a # to the payload before the hex number as its being sent out. cheers

---

<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 December 2018 22:48 UTC](https://discourse.nodered.org/t/inserting-characeter-before-payload-is-sent/6075/2 "2018-12-22T22:48:40Z")

</div>

Hi @patrolin

I assume you are referring to the Node-RED Dashboard colour picker?

There are many possible ways... but each will require adding a node after the dashboard node to modify the message it sends. Take you pick from the following core nodes:

**Template Node**

Configure a Template node (_not_ UI-Template) with the template: `#{{payload}}`

**Change Node**

Configure a Change node to Set msg.payload to the _expression_ type `'#' & payload`

**Function Node**

Configure a Function node with the code:

```auto
msg.payload = "#"+msg.payload;
return msg;

```

---

<div class="post-metadata">

### Author: ![patrolin](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@patrolin](https://discourse.nodered.org/u/patrolin)
#### Post date: [22 December 2018 22:55 UTC](https://discourse.nodered.org/t/inserting-characeter-before-payload-is-sent/6075/3 "2018-12-22T22:55:04Z")

</div>

thanks alot man!!! ive been doing node-red for about a month now, just when i think im gettin somewhere this stumps me. 😀

---

<div class="post-metadata">

### Author: ![patrolin](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@patrolin](https://discourse.nodered.org/u/patrolin)
#### Post date: [23 December 2018 00:32 UTC](https://discourse.nodered.org/t/inserting-characeter-before-payload-is-sent/6075/4 "2018-12-23T00:32:22Z")

</div>

1 more thing not sure wether to start a new topic or not may be a simple,  
using the same RGB picker i need to send the hex value as json to hue bridge. i can use a inject node and inject {"hex": "00000"} and it changes the light colour. the output from the light after state change looks like this ![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/4a16263b9ce21365a64d0bb7bfa0334257761d9e.jpeg)  
i can use the color picker and change node to set the payload msg.hex to the hex value but i cant work out how to get it as a json and send under msg.payload.hex

 ![2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/0/040407930130240af8a75bc73f16c4bca1341401.jpeg)

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [23 December 2018 07:59 UTC](https://discourse.nodered.org/t/inserting-characeter-before-payload-is-sent/6075/5 "2018-12-23T07:59:00Z")

</div>

If you can see what you need in the debug window.  
Take a look at  
[https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)  
which explains how you can use the debug tool tips to copy the path to a data item.It should help you work out how you can change the path to do what you want.

---

<div class="post-metadata">

### Author: ![patrolin](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@patrolin](https://discourse.nodered.org/u/patrolin)
#### Post date: [23 December 2018 23:20 UTC](https://discourse.nodered.org/t/inserting-characeter-before-payload-is-sent/6075/6 "2018-12-23T23:20:59Z")

</div>

cheers mate ive read that page a million times, couldnt get anything to display payload.blahblah but i realised i had to delete the payload to start with to then create a new one.  
well i worked it out. anyone can tell me if this is a long way to do it, seems like the wrong way but it works.

```
        [{"id":"b7642d3e.87515","type":"ui_colour_picker","z":"d526b179.2a93f","name":"","label":"","group":"bfb412ab.18adc","format":"hex","outformat":"string","showSwatch":true,"showPicker":false,"showValue":false,"showHue":false,"showAlpha":false,"showLightness":true,"dynOutput":"false","order":0,"width":0,"height":0,"passthru":true,"topic":"","x":200,"y":100,"wires":[["43b8ef.a509171"]]},{"id":"b0fb3979.ef22e8","type":"debug","z":"d526b179.2a93f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1170,"y":100,"wires":[]},{"id":"d253b0ac.1b9d8","type":"change","z":"d526b179.2a93f","name":"","rules":[{"t":"set","p":"payload.hex","pt":"msg","to":"(hex)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":100,"wires":[["c32415f4.201488"]]},{"id":"a5429590.2f17d8","type":"change","z":"d526b179.2a93f","name":"","rules":[{"t":"delete","p":"payload","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":100,"wires":[["d253b0ac.1b9d8"]]},{"id":"43b8ef.a509171","type":"change","z":"d526b179.2a93f","name":"","rules":[{"t":"set","p":"hex","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":100,"wires":[["a5429590.2f17d8"]]},{"id":"c32415f4.201488","type":"change","z":"d526b179.2a93f","name":"","rules":[{"t":"delete","p":"hex","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":100,"wires":[["b0fb3979.ef22e8","5b753f36.bf6fe"]]},{"id":"5b753f36.bf6fe","type":"link out","z":"d526b179.2a93f","name":"rgbcomputer","links":["739d8083.fbf1e"],"x":1160,"y":180,"wires":[]},{"id":"bfb412ab.18adc","type":"ui_group","z":"","name":"Colour Control","tab":"52f9efff.91cbb","order":11,"disp":true,"width":"4","collapse":false},{"id":"52f9efff.91cbb","type":"ui_tab","z":"","name":"Color Control","icon":"dashboard","order":3}]
```
