The Things Network (TTN) Integration

Connect your TTN v3 application to DataKubo and start ingesting device data automatically.

Prerequisites

  • A DataKubo account with an API key (sign up)
  • A TTN v3 application with at least one registered device
  • A payload decoder configured on your TTN application

Step 1: Add a webhook

In the TTN Console:

  1. Navigate to Applications → Your Application → Integrations → Webhooks
  2. Click Add webhook and select Custom webhook
  3. Configure:
FieldValue
Webhook IDdatakubo
Webhook formatJSON
Base URLhttps://api.datakubo.com/api/v1/ingest/water-consumption
Additional headersX-API-Key: your_api_key
  1. Enable Uplink message under event types
  2. Click Create webhook

Step 2: Configure your payload decoder

DataKubo reads the decoder's output, not the raw bytes. Your TTN application needs a payload formatter that returns the meter's total reading in one of the consumption fields below. Battery and alarm fields are optional.

// Example: meter that sends the reading in liters (4 bytes) and battery in tenths of a volt (1 byte)
function decodeUplink(input) {
  var b = input.bytes;
  // ">>> 0" keeps the value positive when the first byte is 0x80 or higher
  var liters = ((b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]) >>> 0;
  return {
    data: {
      cumulativeFlowM3: liters / 1000,
      battery: b[4] / 10
    }
  };
}

Every meter model encodes its data differently, so use the formatter from your meter manufacturer (or the TTN Device Repository) and make sure its output uses the field names below.

⚠️

TTN messages without a decoded_payload are acknowledged (HTTP 200) but no data is stored. Always configure a payload decoder.

Step 3: Verify data flow

After the next device uplink:

  1. Check TTN Console → Webhooks → datakubo for delivery status
  2. Check DataKubo admin → Devices for the new device and readings

Field mapping reference

TTN Decoded FieldDataKubo FieldNotes
cumulativeFlowM3consumption_m3Preferred — cubic meters
waterconsumption_m3B-Meters alternative
cumulativeFlowconsumption_m3Liters — auto-converted to m³
battery / bateriabattery_levelVoltage
battery_statusbattery_level"OK" → 3.6V, anything else → 2.8V
alarm_burst, alarm_leakage, alarm_overflow, alarm_reverse_flow, alarm_low_battery, alarm_wrong_installationHardware alarmstrue/false only — any other value rejects the uplink. See Hardware alarms

If several consumption or battery fields are present, the first one in the table wins. If none of the consumption fields is present, the reading is stored as 0 m³.

Next steps