How to add a topic to the msg payload

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

6 Likes