# Send a downlink message to the end node via node-red

**URL:** <https://www.thethingsnetwork.org/forum/t/send-a-downlink-message-to-the-end-node-via-node-red/56542>\
**Category:** Generic Node\
**Tags:** mqtt\
**Created:** [April 18, 2022, 10:20pm UTC](https://www.thethingsnetwork.org/forum/t/send-a-downlink-message-to-the-end-node-via-node-red/56542 "2022-04-18T22:20:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RexPr](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/rexpr/32/44547_2.png) [@RexPr](https://www.thethingsnetwork.org/forum/u/RexPr)\
**Post date:** [April 18, 2022, 10:20pm UTC](https://www.thethingsnetwork.org/forum/t/send-a-downlink-message-to-the-end-node-via-node-red/56542/1 "2022-04-18T22:20:03Z")

</div>

I’m using node-red to send a downlink message to the end node.  
The end node, also, sends an uplink message and it works.  
For the MQTT down message, I use the same credential o uplink.  
The topic has been changed on v3/{application id}@{tenant id}/devices/{device id}/down/replace.

This is the payload:

```auto
{"payload":{"f_port":2,"confirmed":false,"schedule":"replace","frm_payload":"AQ=="}}

```

The frm\_payload is the base64 encryption of 0x01.  
But nothing seems received by the device.

The command works if sent directly from the TTN console, where the message payload was set to ‘none’.

I’ve read the documentation (for example [MQTT Server | The Things Stack for LoRaWAN](https://www.thethingsindustries.com/docs/integrations/mqtt/) or [MQTT in Node-RED [HowTo]](https://www.thethingsnetwork.org/forum/t/mqtt-in-node-red-howto/39909)), but without results.  
I need some help in order to debug the sent message and those received by the end node (if it receives it).  
Thanks for any help.

---

<div class="post-metadata">

**Author:** ![RexPr](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/rexpr/32/44547_2.png) [@RexPr](https://www.thethingsnetwork.org/forum/u/RexPr)\
**Post date:** [April 18, 2022, 10:30pm UTC](https://www.thethingsnetwork.org/forum/t/send-a-downlink-message-to-the-end-node-via-node-red/56542/2 "2022-04-18T22:30:35Z")

</div>

One more question, how to form a payload if I want to use the downlink payload formatters from the TTN console?

---

<div class="post-metadata">

**Author:** ![dreimal8](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/dreimal8/32/35697_2.png) [@dreimal8](https://www.thethingsnetwork.org/forum/u/dreimal8)\
**Post date:** [April 19, 2022, 8:18am UTC](https://www.thethingsnetwork.org/forum/t/send-a-downlink-message-to-the-end-node-via-node-red/56542/3 "2022-04-19T08:18:25Z")

</div>

Hi,

my downlink in Node Red looks like this:

```auto
value = percent + time;
value = parseInt(value);
msg.topic = "v3/my-id@ttn/devices/my-device/down/replace";
var bytes = [];
bytes[0] = value >> 8;
bytes[1] = value;

    msg.payload = {
        "downlinks": [{
            "f_port": 1,
            "confirmed": false,
            "frm_payload": Buffer.from(bytes).toString('base64'),
            "priority": "HIGH"
            
        }]
    };
    
    return msg;

```

Hope this helps…

---

<div class="post-metadata">

**Author:** ![MarcBerg](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/marcberg/32/35697_2.png) [@MarcBerg](https://www.thethingsnetwork.org/forum/u/MarcBerg)\
**Post date:** [April 24, 2022, 7:04pm UTC](https://www.thethingsnetwork.org/forum/t/send-a-downlink-message-to-the-end-node-via-node-red/56542/4 "2022-04-24T19:04:57Z")

</div>

The “tenant id” should be “ttn”.

My payload looks like this (input to MQTT Node):

{“downlinks”:[{“f\_port”:1,“frm\_payload”:“AQ==”,“priority”:“NORMAL”}]}

---

<div class="post-metadata">

**Author:** ![RexPr](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/rexpr/32/44547_2.png) [@RexPr](https://www.thethingsnetwork.org/forum/u/RexPr)\
**Post date:** [April 26, 2022, 6:01am UTC](https://www.thethingsnetwork.org/forum/t/send-a-downlink-message-to-the-end-node-via-node-red/56542/5 "2022-04-26T06:01:41Z")

</div>

Sorry, for my late reply.  
Thanks for your answers. It was a trivial syntax error, repeated several times.

I have one more question, how to send a downlink message in JSON format (after setting the payload formatters).
