Last active
November 25, 2016 07:57
-
-
Save venetucci/001946dcd89860f48b5cd1e949afdc9b to your computer and use it in GitHub Desktop.
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 doPost(request) { | |
var params = request.parameters; | |
// Make sure that the request came from our slack integration. | |
if (params.token == "[OUTGOING WEBHOOK TOKEN]") { | |
// Get the spreadsheet | |
var sheets = SpreadsheetApp.openById('[YOUR SPREADSHEET ID]'); | |
// Check command name. If it starts with add, then add to sheet, if it's list topics, then respond with list of topics. | |
var text = String(params.text); | |
if (text.match(/^add:/i)) { | |
addNewItemToSheet(sheets, params); | |
} else if (text.match(/^list topics/i)) { | |
listSheetNames(sheets, params.channel_name) | |
} | |
// If the token does not match then do nothing | |
} else { | |
return; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment