Finding device ID using script, then sending downlink, without widget

Finding device ID using script, then sending downlink, without widget

@

Hi,
I’m stuck at the point where I’m only able to send downlink to a specific Device ID (only if I declared the device id environment variable).

I want to know if there’s a way using script to get triggered device ID and send downlink to the specific ID without declaring any device_id environment variable. I’m currently using node.JS to try out different codes.

I’ve tried to modify the code for checkin status(to find out the device id using script) and sending downlink(send data to device id from envVar after triggered by variable). By using Action, I can run both scripts at the same time, but I want to have a script that is able to combine this two together, so that I can know which was the device ID that needed to send downlink. Is there anyone that can help me on this?