-
-
Save radk2/45e729f5859d76197d8f7e6b53dd6d71 to your computer and use it in GitHub Desktop.
call a webhook on opening Google doc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://developers.google.com/apps-script/guides/triggers | |
function onOpen() { | |
var webhookUrl = 'https://X.X.X.X/'; | |
var payload = { | |
'action': 'Open', | |
'timestamp': new Date().toISOString(), | |
'userInfo': Session.getActiveUser().getEmail() | |
}; | |
var options = { | |
'method': 'post', | |
'contentType': 'application/json', | |
'payload': JSON.stringify(payload) | |
}; | |
UrlFetchApp.fetch(webhookUrl, options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment