# Is it possible to get the active user in a flow?

**URL:** <https://community.homey.app/t/is-it-possible-to-get-the-active-user-in-a-flow/76400>\
**Category:** Questions & Help\
**Created:** [February 12, 2023, 8:10pm UTC](https://community.homey.app/t/is-it-possible-to-get-the-active-user-in-a-flow/76400 "2023-02-12T20:10:51Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [February 12, 2023, 11:02pm UTC](https://community.homey.app/t/is-it-possible-to-get-the-active-user-in-a-flow/76400/2 "2023-02-12T23:02:43Z")

</div>

It is possible when you use an [advanced virtual device](https://community.homey.app/t/app-pro-advanced-virtual-device-device-capabilities-app-with-unique-text-status-indicator/68198) button, available per [Device Capabilities](https://homey.app/a/nl.qluster-it.DeviceCapabilities/) app.

- Button type and settings  

- Flow  

### How-to create and fill the user ID variables

1. Goto [https://tools.developer.homey.app/tools/api-playground](https://tools.developer.homey.app/tools/api-playground)  
In the code field (with some examples in it), remove all text and enter:  
`Homey.users.getUsers();`

- → Now hit the blue RUN button above that field

1. From the returned data, look for similar text, and copy and save these 2 lines for each user (_User Name1 is an example name_):  
`"name":string"User Name1"`  
`"athomId":string"xxxxxxxxxxxxxxxxxxxxxxxx"`  
… and so on
2. Now create and edit the text variable for each user, ending with `athomID` (for example)  
Something like:  
-Name: `UserName1_athomID`  
-Value: copy/paste the “_athomId_” string (without the `"` symbols)

Homeyscript code:

```auto
// send_pushmsg: Pass your created variable [userX_athomId] and "my_push_message":"Hey [name] YourMessageHere" as argument to send them a push message;
// like this: 
// {"userX_athomId":"[userX_athomId]","my_push_message":"YourMessageHere"}

let myArgs = JSON.parse(args[0]);
console.log(`A check of the entered arguments: userX_athomId=${myArgs.userX_athomId}, my_push_message=${myArgs.my_push_message}`)

Homey.flow.runFlowCardAction({
        uri: 'homey:manager:mobile',
        id: 'push_text',
        args: {
			    user: {
			    athomId: myArgs.userX_athomId
		    	},
		    text: myArgs.my_push_message + '\n\n(Optional: Flowname)'
        },
      });
return(true);

```

Partly used for this idea, my original, import-able flow (“_who left the house_”):

> [@The Flow Exchange(r) - Exchange Your Flows with Others!](https://community.homey.app/t/the-flow-exchange-r-exchange-your-flows-with-others/68981/25):
>
> When someone leaves, send a push message to that person Homey hasn’t got a possibility where one can send push messages or push confirmation\*\*\* questions to a user, by using tags/variables. So, no need to create a separate flow/routine for every user anylonger \*\*\*) push msgs and confirmations should be responded to within 30 secs. (HomeyScript limit). Apps used: [HomeyScript](https://homey.app/nl-nl/app/com.athom.homeyscript)How-to fill the user ID variables Goto [https://tools.developer.homey.app/tools/api-playground](https://tools.developer.homey.app/tools/api-playground) I…

---

_[View the full topic](https://community.homey.app/t/is-it-possible-to-get-the-active-user-in-a-flow/76400)._
