Access Gateway Metadata


You can access the global variable normalizedPayload which contains the following metadata:

"deveui": string, // The device's DevEUI
"port": number, // The message's port
"counter": number,
"frequency": number, // GHz
"data_rate": string, // Data rate according to
"coding_rate": string,
"gateways": [
"id": string,
"datetime": date,
"channel": number,
"rssi": number,
"snr": number

This data is extracted from the LoRaWAN Network Server as being forwarded to Datacake over the Webhook. This information is normalized, meaning no matter whether you use TTN, TTI, Loriot, ChirpStack, or Wanesy, the information is always equally available and always formatted in the same way.

Raw Metadata

If you rather want to access the raw payload received from the LNS, you can do so via the global rawPayload variable.

Please note that when you access the rawPayload, the information is not normalized and the content of rawPayload looks different between different LoRaWAN Network Server!

Example Usage

In the following snippet, you find an example of how to read the Metadata from your Payload and how to bring that into your Datacake Payload Decoder section.

function Decoder(payload, port) {
// Output normalized Payload
// Output raw payload coming from webhook of your LNS
// Extract RSSI and Data-Rate from normalized Payload:
// As being "normalized" this works between all LNS:
// Including safety check so that these values really exist
var LORA_RSSI = (!!normalizedPayload.gateways && !!normalizedPayload.gateways[0] && normalizedPayload.gateways[0].rssi) || 0;
var LORA_SNR = (!!normalizedPayload.gateways && !!normalizedPayload.gateways[0] && normalizedPayload.gateways[0].snr) || 0;
var LORA_DATARATE = normalizedPayload.data_rate;
// Build up an array that can be used to forward it onto Datacake:
var decoded = [
field: "LORA_RSSI",
value: LORA_RSSI
return decoded;

Create corresponding fields in Database

In order to store those Metadata-Fields, you can create new Fields on your Device and have historical Data for each field that you forward and store. Here is how this looks for the above example: