Skip to content

Node msg Conventions

zobalogh edited this page Dec 10, 2014 · 7 revisions
Clone this wiki locally

There are a few reserved properties within the structure of the msg objects being passed around in node-RED.

  • msg.payload - contains the main body of the message. For example, the text of a Tweet, the content of a webpage or a sensor reading.

  • msg.title - a title giving a good representation of what the message contains.

  • msg.description - a brief explanation of what data is contained within the message.

  • - some APIs provide large responses. For example, the Twitter api returns a huge object for each tweet containing many properties beyond just the text. This property can be used to store the original response - allowing access to all of the properties, not just those that get pulled out into msg.payload.

  • msg.location - an object containing properties representing location information.

    • - Latitude
    • msg.location.lon - Longitude
    • - the name of a location
  • msg.time - a time. The time should be either JavaScript Date object, or a number of milliseconds since epoch.

For Fitness/activity based nodes/flows:

  • - The ID of the activity in the given fitness system/API
  • msg.payload.type - The type of the activity, example: run/cycle ride
  • msg.payload.duration - Duration of the activity in seconds
  • msg.payload.distance - Distance of activity in metres
  • msg.payload.calories - Calories burned during activity in kilocalories
  • msg.payload.starttime - JavaScript Date object representing the start time of the activity