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:
- Navigate to Applications → Your Application → Integrations → Webhooks
- Click Add webhook and select Custom webhook
- Configure:
| Field | Value |
|---|---|
| Webhook ID | datakubo |
| Webhook format | JSON |
| Base URL | https://api.datakubo.com/api/v1/ingest/water-consumption |
| Additional headers | X-API-Key: your_api_key |
- Enable Uplink message under event types
- Click Create webhook
Step 2: Configure your payload decoder
DataKubo expects decoded payload fields. Make sure your TTN application has a payload decoder that outputs at least one of these fields:
// Example TTN payload decoder
function decodeUplink(input) {
return {
data: {
cumulativeFlowM3: (input.bytes[0] << 24 | input.bytes[1] << 16 | input.bytes[2] << 8 | input.bytes[3]) / 1000,
battery: input.bytes[4] / 10
}
};
}
⚠️
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:
- Check TTN Console → Webhooks → datakubo for delivery status
- Check DataKubo admin → Devices for the new device and readings
Field mapping reference
| TTN Decoded Field | DataKubo Field | Notes |
|---|---|---|
cumulativeFlowM3 | consumption_m3 | Preferred — cubic meters |
water | consumption_m3 | B-Meters alternative |
cumulativeFlow | consumption_m3 | Liters — auto-converted to m³ |
battery / bateria | battery_level | Voltage |
battery_status | battery_level | "OK" → 3.6V, "LOW" → 2.8V |
Next steps
- Webhook Integration — full payload format reference
- API Reference — query ingested data via API