Skip to content

Instantly share code, notes, and snippets.

@the-vampiire
Created August 4, 2017 00:35
Show Gist options
  • Select an option

  • Save the-vampiire/d4416b18f5e9c088eef052ff31ce41e7 to your computer and use it in GitHub Desktop.

Select an option

Save the-vampiire/d4416b18f5e9c088eef052ff31ce41e7 to your computer and use it in GitHub Desktop.
/update command route code
// Excerpt from controller.js focusing on the /update route that Slack sends all /update requests to
router.post('/update', (req, res) => {
const respond = require('./tools/respond');
const body = req.body;
const arguments = body.text;
if(tools.verify.slash(body.token)){
if(~arguments.indexOf(' ')){
// do stuff with argument parser
}else{
if(!arguments) res.send(respond.helpResponse('help'));
res.send(respond.helpResponse(arguments));
}
}else{
res.end('invalid Slack token');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment