title: Is it possible to watch Directory API changes from Google App Maker/Google Apps Script?
body: <p>I'm working on an performance evaluation app in Google App Maker. One of the challenges we have with our current tool is that it doesn't sync with our G Suite directory when a person's manager changes or when a person has a name change -- their existing evaluations are linked to the person's old name and we have to change manually.</p>
  
  <p>In my new app, I have an Employees datasource that includes a relation to the evaluation itself that was initially populated via the Directory API. Reading the documentation <a href="https://developers.google.com/admin-sdk/directory/v1/guides/push" rel="nofollow noreferrer">here</a>, it seems as though I should be able to set up a watch on the Users resource to look for user updates and parse through them to make the appropriate name and manager changes in my Employees datasource. What I can't figure out, though, is what the receiving URL should be for the watch request.</p>
  
  <p>If anyone has done this successfully within Google App Maker, or even solely within a Google Apps Script, I'd love to know how you did it.</p>
  
  <p>EDITED TO ADD:</p>
  
  <p>I created a silly little GAS test function to see if I can get @dimu-designs solution below to work. Unfortunately, I just get a Bad Request error. Here's what I have:</p>
  
  <pre><code>function setUserWatch() {
    var optionalArgs = {
      "event": "update"
    };
  
    var resource = {
      "id": "10ff4786-4363-4681-abc8-28166022425b",
      "type": "web_hook",
      "address": "https://script.google.com/a/.../...hXlw/exec"
    };
    AdminDirectory.Users.watch(resource);
  }
  </code></pre>
  
  <p>Address is the current web app URL.</p>
  
  <p>EDITED TO ADD MORE:
  The (in)ability to use GAS to receive web hooks has been an active issue/feature request since Sep 2014 -- <a href="https://issuetracker.google.com/issues/36761910" rel="nofollow noreferrer">https://issuetracker.google.com/issues/36761910</a> -- which has been @dimu-designs on top of for some time.</p>