Ah, I figured msg.payload
was the MQTT payload. But in case of the TTN Node-RED library this seems to be the LoRaWAN application payload? If this implies that each device is sending a unique ID in its LoRaWAN application payload, while each device can already be uniquely identified using its registration in TTN Console (which is included in the MQTT message), I’d say that’s a bit of a waste. Also, it seems you’re sending text? Even more wasteful.
Note that your Node-RED scheduled downlink will probably not (always) be sent after the uplink that scheduled it, so that won’t work; see My application's downlink is always queued for next uplink. Also, it seems you’re reinventing the LoRaWAN confirmed uplink, which handles this much better. (But in any case: on the community network you’re limited to at most 10 downlinks or confirmed uplinks per day, per device.)