Getting device tokens from device tags

Hi there,

I am trying to make get all device tokens of multiple devices that have the same tags in my analysis. Is that possible right now? If so, may I receive some code template or explanation of some sort?

Thanks!
Daniel

2 Likes

You can use the analysis snippet for “Get Device List” that is available when you create your analysis.

It does have the instructions on how to get your device list, filtering by tags.
Once you have the list, you can just iterate through the list and get the tokens, much like this:

for (const dev of device_list) {
  const token = await Utils.getTokenByName(account, dev.id);
  console.log(dev.name, token); // output to console the device name and it's token.
}
1 Like

It works, thanks Vitor!