How Do I Get External User Email Address From Collaborations Webhook or API?
I have this use case -- our firm has some folders where we put stuff that can be shared with external users.
I believe our internal users still have to pass some approval process before, inviting someone outside our firm to collaborate on the folder.
I was asked to build some mechanism to notify the other collaborators on these external folders, when new external collaborations are added to the folder, so they can speak up if the wrong person is invited. Sounded simple enough.
1. I added a V2 webhook to the parent folder where all external folders are located, that triggers when collaborations are created or modified.
2. Created an Azure cloud function to handle the webhook payload, that uses the Box API to pull all the collaborators on the folder, extract their emails, and email them (used the Microsoft Graph API for this, as we're on O365).
Only issue is -- the webhook payload does not include the email address (or any other useful info) of the external user that was triggered by the collaboration being created. Works great on managed (internal) users. But when the user is external, the accessible_by property is actually null in the webhook payload. And when I query the Box API for collaborators on the folder id from the webhook, the external user isn't even listed.
I want to include the external user email address in the email body of the notification I send to our users.
I also tried querying the Box API for pending collaborations, after creating an external collaboration, and leaving it as pending, and the API returned nothing.
Is there any way to get the external user email address somehow, or some other way of solution for my use case?
Happy to provide code, or more details, if needed.
Please sign in to leave a comment.
Comments
0 comments