# Change payload topic

**URL:** <https://discourse.nodered.org/t/change-payload-topic/28167>\
**Category:** General\
**Created:** [11 June 2020 10:54 UTC](https://discourse.nodered.org/t/change-payload-topic/28167 "2020-06-11T10:54:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![christian19](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian19/32/23687_2.png) [@christian19](https://discourse.nodered.org/u/christian19)\
**Post date:** [11 June 2020 10:54 UTC](https://discourse.nodered.org/t/change-payload-topic/28167/1 "2020-06-11T10:54:48Z")

</div>

Embarrassing enough I have no idea how to change a topic on a message. I have tried the change node without luck.

So, I get the following message, and want to change the topic to "value".

```auto
 : msg.payload : number
1006

```

Would be nice if anyone could point me in the right direction!

---

<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:** [11 June 2020 11:15 UTC](https://discourse.nodered.org/t/change-payload-topic/28167/2 "2020-06-11T11:15:32Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/5/1525181b924da26a2c88646c1e39aef69581e3d5.png)

Or...

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/0/80814c7e580acc0af732f6aad9c047d3d953ac0d.png)

Or - add a function node and put this code in...

```auto
msg.topic = "a new string";
return msg;

```

Or you could do something like.

```auto
msg.topic = msg.payload;
return msg;

```

I recommend watching this playlist: [Node-RED Essentials](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). It is by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in less than an hour. A small investment for a lot of gain.

---

<div class="post-metadata">

**Author:** ![christian19](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian19/32/23687_2.png) [@christian19](https://discourse.nodered.org/u/christian19)\
**Post date:** [11 June 2020 11:34 UTC](https://discourse.nodered.org/t/change-payload-topic/28167/3 "2020-06-11T11:34:14Z")

</div>

Thanks!

Im trying to use the value. In the documentation it says this:

```auto
amount(optional) number
If provided, the output will contain this amount in 

```

And this is the result after your suggested change:

```auto
value : msg.payload : number
996.19

```

Still not working.

---

<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:** [11 June 2020 11:36 UTC](https://discourse.nodered.org/t/change-payload-topic/28167/4 "2020-06-11T11:36:52Z")

</div>

I have no idea what node you are talking about and without showing your flow it's hard to assist.

Your title said "change payload topic" the info I provided does that.

What is it exactly you need?

Show screen shots of you flow and the debug output of before and after what you want to change.

Ps. Watch those videos. They will help you solve this yourself.

---

<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:** [10 August 2020 11:36 UTC](https://discourse.nodered.org/t/change-payload-topic/28167/5 "2020-08-10T11:36:58Z")

</div>

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