title: Creating a webapp for managing Gmail email signatures for all employees from one place
body: <p>I'm trying to create an application which allows the HR team to manage signatures for all the employees. Right now they use Gsuite to manage all the Gmail accounts of the employees. I'm looking for something which is similar to <a href="https://gsuite.google.com/marketplace/app/signaturesatori_email_signature_manageme/228371523437" rel="nofollow noreferrer">Signature Satori</a></p>
  
  <p>I've tried using Gmail API to access the profile settings of a user and change the email signature of that authorized user. as shown [here]. Using the following code I've changed the signature on my gmail. (<a href="https://developers.google.com/gmail/api/guides/alias_and_signature_settings" rel="nofollow noreferrer">https://developers.google.com/gmail/api/guides/alias_and_signature_settings</a>)</p>
  
  <pre><code>from __future__ import print_function
  from apiclient import discovery
  from httplib2 import Http 
  from oauth2client import file,client,tools
  
  import pickle
  import os.path
  from googleapiclient.discovery import build
  from google_auth_oauthlib.flow import InstalledAppFlow
  from google.auth.transport.requests import Request
  
  SCOPES = 'https://www.googleapis.com/auth/gmail.settings.basic'
  
  creds = None
  store = file.Storage('storage.json')
  creds = store.get()
  if not creds or creds.invalid:
      flow = 
      client.flow_from_clientsecrets('client_secret.json',SCOPES)
      creds = tools.run_flow(flow,store)
  
  GMAIL = discovery.build('gmail','v1',http=creds.authorize(Http()))
  
  addresses = 
  GMAIL.users().settings().sendAs().list(userId='me')
  .execute().get('sendAs',[])
  for address in addresses:
      if address['isPrimary']:
          break
  
  
  print(addresses)
  def signature():
      return 'hhello' + str(address['sendAsEmail'])
  
  DATA = {'signature': signature()}
  
  rsp = 
  GMAIL.users().settings().sendAs()
  .patch(userId='me',sendAsEmail=address['sendAsEmail'],body=DATA)
  .execute()
  print(f'Primary address signature changed to {rsp['signature']}')
  </code></pre>
  
  <p>I want to do this and provide a template for all the users in the company managed from Gsuite. Any ideas of how to approach this problem?</p>