I just saw this comment. Sounds useful. You may also want to be able to use it in automations like with Role Machine or others. To do both of those you'd likely want to write a driver so that you can use attributes for values and events on changes to attributes.
I have a few other drivers that interact with various web APIs to provide this functionality. Let me know if you want to look at one as a sample and I'll try to find one that is close to what you would need.
They contain a lot more code, but it really isn't all that more complicated in concept than the app you already have working.