# How to add a topic to the msg payload

**URL:** <https://discourse.nodered.org/t/how-to-add-a-topic-to-the-msg-payload/4880>\
**Category:** General\
**Created:** [14 November 2018 21:57 UTC](https://discourse.nodered.org/t/how-to-add-a-topic-to-the-msg-payload/4880 "2018-11-14T21:57:58Z")\
**Posts on this page:** 1\
**Showing post:** 3

<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:** [14 November 2018 22:04 UTC](https://discourse.nodered.org/t/how-to-add-a-topic-to-the-msg-payload/4880/3 "2018-11-14T22:04:47Z")

</div>

So you want to add msg.topic to the message object. You can do this is numerous different ways

In a function node:

msg.topic = "what ever you want"  
return msg;

IN a change node:  
Set msg.topic  
to what ever you want

You can configure the debug node to "output" "complete message object" which will display the whole message object to check it has done what you want

---

_[View the full topic](https://discourse.nodered.org/t/how-to-add-a-topic-to-the-msg-payload/4880)._
