title: How can I setup alerts on account change activity in GSuite?
body: <p>So, I want to set alerting on whenever the status of a user in gsuite changes. Like if the user's status changes from <code>active</code> to <code>suspended</code> or when a user is <code>deleted</code>.</p>
  
  <h3>My Approach</h3>
  
  <p>I've setup notification channels on the directory api as mentioned here : <a href="https://developers.google.com/admin-sdk/directory/v1/guides/push" rel="nofollow noreferrer">https://developers.google.com/admin-sdk/directory/v1/guides/push</a>.
  Then as soon as you register for the channel there's an oauth link which you need to open in a browser and allow it, the usual oauth flow.</p>
  
  <p>However the problem is this <code>channel</code> gets expired after almost 2 days or 2 weeks ( not sure of the exact time ) and so I've to do this again and hence it's a manual process which needs to be taken care of quite frequently.</p>
  
  <p>I want to automate this or if so someone can guide me with a better approach.</p>
  
  <p>I read somewhere about delegated credentials but didn't get it to working ( don't remember the exact issue with it but it wasn't working ). I've looked up this <a href="https://stackoverflow.com/questions/49374112/google-service-account-cant-impersonate-gsuite-user">Google service account can&#39;t impersonate GSuite user</a>. This doesn't apply to my case.</p>
  
  <p>I do understand there should be robot accounts for this. Just the thing is I can't figure out any good documentation of this.</p>
  
  <p>I am on the GSuite Basic plan and we've around 150 users.</p>
  
  <p>My code is in python.</p>
  
  <p>Thanks.</p>