# Decoder Function

### Overview

Decoder Functions in Qubitro allow you to **decode incoming payloads** before storing data.&#x20;

Depending on your device type and data format, you can choose from different decoder options to ensure data is structured correctly.

{% hint style="success" %}
Once a **decoder function** is created, it runs automatically for incoming data **without requiring manual activation**.
{% endhint %}

{% hint style="info" %}
If needed, the function can be **disabled from the functions list** under the device’s **Functions** tab without deleting it.
{% endhint %}

<figure><img src="https://3109056034-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfQfo4zX1x0hfOimS9E2u%2Fuploads%2FduiFr2uL1j3XufSjdhu0%2Fimage.png?alt=media&#x26;token=8f83a993-7c84-4b1a-890c-5ea600e8ebac" alt=""><figcaption></figcaption></figure>

### Choosing the Right Decoder

Qubitro provides three types of decoders, each suited for different integration needs:

#### **LoRaWAN Device Template Decoder**

Use this option if your LoRaWAN device has a **predefined template** in Qubitro. It allows you to **automatically decode** incoming payloads without writing custom logic.

* [x] Works with **all LNS providers** (The Things Stack, ChirpStack, etc.).
* [x] Requires **no custom scripting**—simply select a template from the portal.
* [x] Ensures **consistent and accurate decoding** based on manufacturer specifications.

{% hint style="info" %}
If you use the LoRaWAN Device Template Decoder, device templates for dashboards will work automatically, enabling instant visualization of decoded data.
{% endhint %}

{% content-ref url="decoder-function/lorawan-device-template-decoder" %}
[lorawan-device-template-decoder](https://docs.qubitro.com/platform/functions/decoder-function/lorawan-device-template-decoder)
{% endcontent-ref %}

#### **LoRaWAN Custom Device Decoder**

Use this option if your LoRaWAN device **does not have a predefined template**. You can write **custom JavaScript** to decode payloads manually.

* [x] Works with **all LNS providers** (The Things Stack, ChirpStack, etc.).
* [x] Requires **custom JavaScript** to parse incoming payloads.
* [x] Ideal for **custom or new LoRaWAN devices** that are not yet available as templates.

{% content-ref url="decoder-function/lorawan-custom-decoder" %}
[lorawan-custom-decoder](https://docs.qubitro.com/platform/functions/decoder-function/lorawan-custom-decoder)
{% endcontent-ref %}

#### **HEX Payload Decoder**

Use this option if your device **sends data in hex-encoded format instead of JSON**. It converts **hex-encoded strings** into structured JSON.

* [x] Works with **non-LoRaWAN devices**, including [**MQTT**](https://docs.qubitro.com/data-sources/mqtt)**,** [**HTTP**](https://docs.qubitro.com/data-sources/http)**,** [**Onomondo**](https://docs.qubitro.com/data-sources/no-code-integrations/onomondo)**, and more**.
* [x] Converts **hex-encoded strings** into readable JSON.
* [x] Useful for devices that **cannot publish raw JSON directly**.

{% content-ref url="decoder-function/hex-payload-decoder" %}
[hex-payload-decoder](https://docs.qubitro.com/platform/functions/decoder-function/hex-payload-decoder)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.qubitro.com/platform/functions/decoder-function.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
