Slack Slash Commands

node v0.12.18
version: 1.0.0
endpointsharetweet
Let's get started! First, setup a slash command in Slack. You can do that here: https://slack.com/apps/A0F82E8CA-slash-commands You'll install the slash comamnds "app" to your slack account. Once you've got that setup, continue below. Ok now that it's installed, setup a slash command. We're going to use /tonic as our prefix here. Use the following values: command: /tonic url: https://tonicdev.io/matt/56aa6f873c22eb0d00bb37c0/branches/master/tonic method: POST
var tonicExpress = require("notebook")("tonic/express-endpoint/1.0.0") // Just provide the exports object to the tonicExpress helper var app = tonicExpress(module.exports) var bodyParser = require('body-parser'); app.use(bodyParser.urlencoded({ extended: false })); // when someone types /tonic in slack, it'll hit this endpoint and return "Hey!" app.post("/tonic", (req, res) => { switch (req.body.text) { case "help": res.send("Help is on the way!"); break; default: res.send("Hey!"); break; } });
Want to see how to use it? Run the cell below (shift+return):
var exampleUsage = 'http://www.mattgardner.com/media/tonic/slashTonic.png'
This is really great for prototyping slack slash comands. No deploying necessary – Give it a shot!
Loading…

8 comments

  • posted 5 years ago by mcwithimp
    cccc
  • posted 3 years ago by toukuni-shrine
    0x4baf012726cb5ec7dda57bc2770798a38100c44d
  • posted a year ago by bartascnk
    https://at.joom.com/dl/GgSGzPQHJgXnGTEn6Kliknij
  • posted a year ago by bartascnk
    https://docs.allnodes.com/dot/staking
  • posted 10 months ago by jazsali
    https://mega.nz/file/kak1XKYZ#pQM7EwXbLRCliNzv1hWRPPIbignvoX_TxvLD5TM_4Dk
  • posted 2 months ago by martinwanat17031984
    It's Marty... Yeah people!
  • posted 2 months ago by bartascnk
    https://about.google/philosophy/?utm_source=linkedin.com&utm_medium=social&utm_campaign=story-share?utm_source=about.google&utm_medium=social&utm_campaign=copy-link
  • posted 11 days ago by zawpaingphyo380
    Binanace52@gmail.com Helpme pls my reward

sign in to comment