Extract Tags from Urban Airship

By Jimmy Bonney | May 4, 2015


Urban Airship is a platform allowing companies to easily send notifications and rich messages to their customer base. The web application allows to define messages to send and one of their key feature is the possibility to group customer targets into segments. Those segments are created based on a set of tags – each tag usually describing the behavior of the user on the app (for instance, a tag might be set to users that logs in, users that have used feature X 3 times, users that have bought in app, etc.).

Segments are therefore a powerful way to address users based on action that they have taken (or not taken) while using the application. There is however currently one drawback: there is no proper way to list all tags that are available in Urban Airship. As an example, the current API only allows to retrieve 100 tags (no pagination so this is only the first 100 tags). There is therefore no way to get a complete picture of the tags present in the system.

In order to get a better picture, it is necessary to list all channels (as an approximation, one channel is equivalent to one device) and extract the tags from these channels. One should however be careful since a channel might be inactive. Inactive channels are coming from devices on which the application was previously installed and then removed.

In order to get a better picture of the tags available, I have therefore created a script based on the urbanairship gem. The project is available on BitBucket (see here) and provide a command line interface to get a list of all tags in the systems.

Do note that the tags extracted from the channels might not be present in the list of 100 tags that are returned when calling the tag API. Indeed, it is possible to create tags that are not yet set on devices and therefore will not be listed when executing this script.

The current script has not yet been tested when there are more than 1000 channels. It should handle it properly but since this has not been tested it might require some additional work.

comments powered by Disqus