Code to create a Google Apps Script project to update the signature on multiple users of a Google Workspace instance.
A screenshot to demonstrate functionality:
This tool impersonates users on your Google Workspace instance, and updates their Gmail signatures to the HTML set in "Signature HTML"
Uses OAuth2 Library along with a service account with domain-wide delegation.
-
Create a Google service account.
Give it domain-wide delegation, the only permission you need to add here ishttps://www.googleapis.com/auth/gmail.settings.basic. -
Press + next to "Libraries" on the lefthand sidebar. Use Google's apps-script-oauth2 ID
1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF, press "Look up", and press "Add".
Press + next to Services, select "Admin SDK API", and press "Add" -
Copy and paste the contents of src/Code.gs into Code.gs in Google Apps Script.
Copy and paste the contents of src/main.html into a new html file in Google Apps Script, and call it main. -
Fill out your domain name at the top.
Get your private key from the service account area that you made in step 2 and paste it in the constantPRIVATE_KEY. Do the same for the service account email address. -
Click "Deploy" at the top right, click "New deployment". Click the cog next to "Select type", choose "Web app". Add a description, press "Deploy". Authorise access, then you can access the web interface with the link under "URL".
