Skip to content

Instantly share code, notes, and snippets.

@tomrandle
Created October 17, 2016 13:57
Show Gist options
  • Save tomrandle/2ba93b2399dd9b15e3e2c8246a7ebf54 to your computer and use it in GitHub Desktop.
Save tomrandle/2ba93b2399dd9b15e3e2c8246a7ebf54 to your computer and use it in GitHub Desktop.
triggerSlackRequest
function triggerSlackRequest(channel, msg) {
var slackWebhook = "YOUR PERSONAL SLACK TOKENIZED URL";
var payload = { "channel": channel, "text": msg, "link_names": 1, "username": "lunchbot", "icon_emoji": ":hamburger:" };
var options = { "method": "post", "contentType": "application/json", "muteHttpExceptions": true, "payload": JSON.stringify(payload) };
Logger.log(UrlFetchApp.fetch(slackWebhook, options));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment