google-cloud-platformgoogle-workspacegoogle-cloud-identity

Can you programmatically add external users to Google Groups?


I am building a mailing list for customers using Google Groups. I am trying to programmatically sync customer email addresses from a contact database to a preexisting Google Group using the Cloud Identity API (link). It works for email addresses in our organization, but I am getting a 403 for non-Google addresses when invoking the create method for the groups.membership resource (link). The specific error is Error(2028): Permission denied for resource groups/******** (or it may not exist).

I am hoping that non-Google email addresses can be added to groups with the API. Below are variations of what I have tried so far.

Configuration Details

Request Details

I have also confirmed that the email address can be added through the Groups UI. My suspicion is that it has to do with the EntitityKey (link), but I haven't found a value that works.


Solution

  • I could not find out whether this is possible with the Cloud Identity API. But it is possible to add external users to a Google Group using the Admin SDK, specifically the members.insert method for the Directory API (link). Just make sure that the Member in your request has type set to EXTERNAL.