Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

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…

5 comments

  • posted 4 years ago by mcwithimp
    cccc
  • posted 2 years ago by toukuni-shrine
    0x4baf012726cb5ec7dda57bc2770798a38100c44d
  • posted 9 months ago by bartascnk
    https://at.joom.com/dl/GgSGzPQHJgXnGTEn6Kliknij
  • posted 9 months ago by bartascnk
    https://docs.allnodes.com/dot/staking
  • posted 2 months ago by jazsali
    https://mega.nz/file/kak1XKYZ#pQM7EwXbLRCliNzv1hWRPPIbignvoX_TxvLD5TM_4Dk

sign in to comment