How to store a string (device/variable API label) in Ubidots and use it dynamically in a Function

Question:
I want to create a UI input where a user can type:

  1. The API label of a device.
  2. The API label of a variable belonging to that device.

Later, with those two values, I want to send a numeric value to that selected device and variable. In other words, the target device and variable are not fixed — they are chosen dynamically by entering their API labels in text fields.

What is the simplest working example (Custom UI + UbiFunction or webhook) that lets me:

  • accept device and variable labels as strings (text inputs),
  • then send a numeric value to the variable I selected,
  • all in one flow.

Also: Is it possible to store those strings somewhere (e.g. in a context variable or another Ubidots variable) so the user doesn’t need to retype them each time?

I’m using JavaScript / Ubidots Cloud Functions. Any working snippet or guidance is welcome.