Messenger

Docs / Widgets / Two-way / Messenger
Two-way widget

Messenger

A Messenger is a chat with your device. Type a command like fan on and the board answers in its own bubble. The device can also send you alerts and status messages on its own.

Dashboard ↔ deviceText, up to 256 characters6 quick themes1 Telemetry Point

Try it

Type fan on, fan off or status in the chat and press send. The NuttyFi board reads the text and answers in its own bubble. The buttons under the board send a message from the device, like an alert.

SimulationLIVE
Dashboard
This is the Messenger widget from the dashboard.
Your device
NuttyFiMCU · Wi-FiONLINENUTTYFILAST COMMAND—Fan controller
The board reads and answers on the same Telemetry Point.
Widget Color
Quick themes
Show
Messages are textA Messenger always uses a string Telemetry Point. The app sets the DATA TYPE to string for you when you link the point.

How to add and set up

  1. Open the dashboard in edit modeOpen the device and turn on editing.
  2. Add a MessengerPress + on the right edge of the canvas and pick Messenger. Drag it into place and make it tall enough to read a few messages.
  3. Open its settingsClick the gear icon on the widget.
  4. Link a Telemetry PointUnder Linked Telemetry Points, pick a free point, for example TP0. Its DATA TYPE is set to string. Use a point that no other widget uses.
  5. Pick a lookChoose one of the Quick themes, or set your own bubble colours under Customize. Save, then press DONE.

Settings

SettingWhat it does
Widget NameThe name in the chat header, like the name of a contact.
Label ColorColour of the name.
Linked Telemetry PointsThe Telemetry Point the chat uses in both directions. Your device code uses the same point.
Quick themesOne tap sets both bubbles: Classic, Ocean, Mint, Sunset, Mono or Neon. Without a theme, your bubbles use the Widget Color and the device bubbles follow light or dark mode.
CustomizePick the device bubble or your bubble, then set its Background or Text colour. If the text becomes hard to read, the app says Text is hard to read on this bubble. and Fix picks a readable text colour.
Widget ColorColour of the outline and the avatar, and of your bubbles and the send button when no theme is set.
Hide widget Name / Telemetry Point / Widget BorderHide the name, the TP badge or the outline around the widget.

Messages and limits

WhatHow it works
Your messagesShown on the right. Each one is sent to the device on the linked point, as text.
Device messagesShown on the left. Whatever the device sends on the same point appears as a new bubble right away.
LengthUp to 256 characters per message. A counter appears when you get close to the limit.
HistoryThe chat opens with the latest 50 messages. Messages are kept for 30 days, then removed automatically.
Sending rateUp to 30 messages a minute per device. Over that, wait a moment before sending again.
Delete historyThe bin icon in the header clears every message on this point for this device. It does not touch other points or devices, and cannot be undone.
Edit modeWhile you edit the dashboard, the chat shows a sample. Sending works in live mode.

Receive and reply on your device

Your board receives each message with SME_LISTEN on the linked point and answers with SME.publish() on the same point. Read the text with data.toString(). The examples use TP0.

C++ · Arduino
#define FAN_PIN 5

SME_LISTEN(TP0)
{
  String msg = data.toString();   // the text you typed
  msg.trim();
  msg.toLowerCase();

  if (msg == "fan on") {
    digitalWrite(FAN_PIN, HIGH);
    SME.publish(TP0, "Fan ON");
  } else if (msg == "fan off") {
    digitalWrite(FAN_PIN, LOW);
    SME.publish(TP0, "Fan OFF");
  } else {
    SME.publish(TP0, "Try: fan on, fan off");
  }
}
Send messages, not readingsMessenger is for commands, replies and alerts. Send an alert once when it happens, not on every pass of loop(). For readings that change all the time, use a Value or Graph.

These are snippets. Your sketch also needs #include <SMEIoT.h>, SME.begin(...) in setup() and SME.run() in loop(). The full sketch tab shows a complete example; see the SDK quick start for more.

Was this page helpful?