Created
October 22, 2017 17:36
-
-
Save jhershauer/96c1c07a713699814d5074aa69134ae0 to your computer and use it in GitHub Desktop.
Call Ryver Webhook from Google Apps Script
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
function sendToRyver_(url,payload) { | |
var options = { | |
"method" : "post", | |
"contentType" : "application/json", | |
"payload" : JSON.stringify(payload) | |
}; | |
return UrlFetchApp.fetch(url, options) | |
} | |
function callWebhook(e) { | |
//Note: You need to substitute your Ryver webhook URL here | |
var url = "https://example.ryver.com/application/webhook/8xtO4GzWw8PQGAI"; | |
//Note: You can use markdown to format your chat/post/task body text | |
var body = "**Product:** " + e.values[1] + | |
"\n**Supports Webhooks:** " + e.values[2] + | |
"\n**Integrate How?:** " + e.values[3]; | |
var payload = { | |
"subject" : "Integration Request: " + e.values[1], // Note: No subject if it is a chat webhook | |
"body" : body, | |
} | |
sendToRyver_(url,payload) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment