Getting started with FRED

Hello everyone, i'm learning how to use FRED and thingspeak, basically i'm trying to publish on two thingspeak datastreams two fields from a json file that i'm getting from a weather site. What i'm unable to do is writing the function that will enable me to publish on thingspeak with mqtt. I'm able to extract the data since they work from the debug.

This is my structure and the function i'm trying to write. thanks.


try:

msg = {topic: "channels/<1752931>/publish", payload : {field1: msg.payload.main.temp, field2: msg.payload.main.humidity}}

thanks for the answer i actually managed to find the problem. it's about the way you concatenate stuff in the functions. i wrote something like this:

var channelID = "1752931";
var temp = msg.payload.main.temp;
var humidity = msg.payload.main.humidity;
msg.topic = "channels/" + channelID + "/publish"
msg.payload ="field1=" + temp + "&field2=" + humidity;
return msg;

have a nice day!