Since we have a non-profit edition of Google Workspace, we can use google groups with group email id like email@ourdomain.tld for a group created using the admin console, and users can be added to such groups using the API. My trial scripts have been added to this github repo, Google-groups-GAS-tests. Some points to note -
- As seen in the medium post I used as reference, we have to give a sleep statement after calling group.hasUser() to avoid errors.
- We can't use the add or remove functions on @googlegroups.com groups, but listing users etc works.
- The AdminDirectory service in Google Apps Script is lacking in documentation, as are the other services, with AdminDirectory.Members.remove() being an example of an insufficiently documented function - in the REST API, the function is called delete. Most people suggest using the autocomplete option in the script editor to find documentation about the advanced services!
- When calling the deployed GA script as a web app, the Logger.log logs don't appear in the Executions tab by default - even removing the tick for "Log uncaught exceptions" did not help - looks like we need to associate the project with a GCP project in order for that to work. Or, apparently, console.log is the preferred method now.
- We should be aware of the limits -
https://support.google.com/a/answer/6099642#zippy=%2Cmessage-and-posting-limits says Total external recipients** per group = 50,000 per day So, if we need a cushion to send more than one message per day, we would need to keep the number of users below 25k.
No comments:
Post a Comment