I would like to match users from a list of email addresses coming from an other app, in order to add all the users to one group, and remove members that are not in the . I’ve got a script doing that from the API.
The removing part is easy. For each member, I extract all their emails with: get(/u/{username}/emails.json)
and I try to match each one against the list. If there is none, the member is excluded.
The including one is trickier. For each email address, I want to see if there is a user with that address. If there is, I add it to the group. If there is not, I don’t want to send an invite. I use the command: get(/admin/users/list/all.json?email={email})
but this command returns a list of users with that address as primary, an not the ones with that address as secondary, nor unconfirmed_emails, nor associated_accounts. Is there a way to filter from every possible email addresses, or should I export the list of all users and do that by hand externally ? I would prefer doing it internally so there would be less risks of data leaks.