Databoom provides the possibility to connect your own device with a server (broker) through MQTT protocol. In order to transmit the data, it is necessary to create a client that sends the parameters in the required format. Follows the procedure for Node.js.

Read also: How to communicate with Databoom using MQTTBox or MQTTLens

mqtt module

For the creation of a MQTT client in Node.js the mqtt module is used

npm install mqtt

In your code the following fragment is then required:

var mqtt = require('mqtt');

Creation of a MQTT client in Node.js

The creation of the client follows the structure:

var settings = {
username:"", //DATABOOM USERNAME

var client = mqtt.connect("mqtt://", settings);

clientId is the token of your own device. The token is generated by Databoom when creating the device, and can be retrieved in the edit screen of the required device. To connect to the broker you need to authenticate yourself with your username and an OAuth token. The address of Databoom broker is, on port 1883, so we use mqtt://

Parameters structure

The parameters to send must be in JSON format, in particular we use the following structure:

var post_data = {
date: new Date(),
signals: [{
name:"", //SIGNAL TOKEN
value:0 //SIGNAL VALUE

device is the token of your own device, it is retrieved from the settings of the client created in the previous step, while date is the communication date (in the example we use the current date, if the field is not specified, the receive date is used instead). The device field can be skipped, in this case the token from the topic is used instead. signals is the array that will contain the device signals. Signals consists of name, that is the signal token, and value.

If you want to update a signal that is already in Databoom, name must correspond to the token. If the signal is not in Databoom, it is inserted using name as token. The value must be unique within the device.

The parameters are then parsed to string so they can be sent to the topic of the broker correctly

post_data = JSON.stringify(post_data);

Publishing data on the topic

Once the data cration has ended, it is possible to proceed with their publication on the topic of Databoom broker

client.publish("databoom/" + settings.clientId + "/data", JSON.stringify(post_data), function () {
console.log(newDate().toISOString(), "\tDATA PUBLISHED ON", "databoom/"+settings.clientId+"/data");

The topic must be setted to databoom/DEVICE TOKEN/data (otherwise the data will be ignored). post_data must be a string. In the callback are then showed some log messages to confirm parameters sending.

It is also possible to subscribe to the events topic databoom/TOKEN DISPOSITIVO/events to supervise events of the device, as for example published data reception confirm.

client.on('connect', function () {
console.log(newDate().toISOString(), "\tCLIENT CONNECTED TO DATABOOM BROKER")

client.on('message', function (topic, message) {
console.log(newDate().toISOString(), "\tDATA PUBLISHED ON", "databoom/"+settings.clientId+"/events");

Sending commands

To send a command to the device, the topic to use is databoom/DEVICE TOKEN/commands. By sending a commmand, an event is created in Databoom.

The syntax to use is: 

"description":"", //EVENT DESCRIPTION
"signal":"", //SIGNAL TOKEN
"payload":"", //COMMAND
"tags":["",""] //EVENT TAGS

The payload can vary according to the format required by the device. It is also possible to subscribe to the same topic to verify the forwarded data.


For testing purposes, you can use the reserved ID debug for your client. With the debug ID it is possiblo to publish or subscribe to every topic (data, events o commands) of devices of which you are administrator or creator.

Configuration completed!

Once the procedure has been completed, Databoom starts to record data sent with MQTT. To examine your data and have a correct representation, follow the instructions in Edit/validation of a signal.

Have more questions? Submit a request


Please sign in to leave a comment.