Message — basic information unit

What the message in flespi includes and how to access it.

A message is a number of telemetry parameters received by the flespi channel from a single tracking device grouped by the time of receipt. Each message must have: 

  • ident a device identification field
    Note: Symbols '#', '+', '/', and all non-printable ASCII characters are not allowed in idents.

  • timestamp — time when telemetry was collected (in UNIX time format);

  • server.timestamp — time when the message was received by flespi channel (in UNIX time format);

  • — the ID of a channel handling the connection;

  • — the ID of a protocol channel is configured to work with.

If a message is coming from the device, registered in flespi, additional messages fields are expected:

  • - the ID of the corresponding device;
  • - the name of the corresponding device.
  • - the ID of the corresponding device type;

All other message parameters depend on the device protocol, type, configuration and plugins, attached to the device. The full list of possible parameters accepted by the channel operated over specified protocol can be found on the appropriate protocol page, e.g.

Read more about flespi message parameters in a dedicated blog post.

The naming of message parameters is unified, it means that parameters with the same meaning received from different trackers over different protocols will get identical names and measurement units in flespi. The full list of parameters supported by flespi can be retrieved via an appropriate API call. A message is represented by the plain JSON object with parameter names as keys.

There are three ways to access messages received by the flespi channel:

  1. HTTP REST API call — get messages from the channel’s internal buffer.

  2. Push-mode streams — flespi will push messages to the specified platform.

  3. MQTT API — receive messages via MQTT client subscribed to the appropriate topic.

Below is the scheme showing the path of a message from the tracking device through flespi and to the flespi user:

ways to access messages in flespi

A device sends a message to the flespi channel. As soon as the flespi channel accepts the message, it can be delivered to the user on channel level in one of the following ways:

  • Stored in the channel buffer to be returned in GET /channel/messages REST API call

  • Pushed via MQTT to the topic flespi/message/gw/channels/#

  • Sent via a stream

If there is a registered device with a matching ident field, the message goes to the device instance and can be delivered to the user on the device level in one of the following ways:

  • Stored in the device message buffer to be returned in GET /devices/messages REST API call

  • Pushed via MQTT to topic flespi/message/gw/devices/#

  • Updated in the telemetry structure so the user can receive only changed message parameters

  • Sent via a stream

To understand the message lifecycle in more detail please refer to this article.

The lifetime of a message is limited by the time-to-live parameter of the message buffer. Setting the messages_ttl parameter in the channel configuration to 0 will result in the deletion of all messages in the channel buffer.

See also
Use groups of devices to add more structure to your account and easily assign multiple devices to streams, plugins, and calculators.
Manually posting messages into a flespi device.