Getting device tokens from device tags

@Daniel Garcia

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

@Vitor Lima

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.
}

@Daniel Garcia

It works, thanks Vitor!

Team,

According to the SDK documentation, you are deprecating getTokenByName. In that documentation you do not indicate what is replacing this function. That sure would be helpful. Also you’re deprecating the Account item as well.