Search code examples
node.jsslack

How to get variables from slack custom command into param


I wrote a node app that takes a d param and responds with a random dice roll:

https://{some app}.herokuapp.com/roll/dice?d=20

The user can also add a number to the end of the dice roll like:

https://{some app}.herokuapp.com/roll/dice?d=20&a=5

The api works fine. I am trying to get this to integrate with slack so that users can type

 /roll 20

or

 /roll 20 5

but I am unable to figure out how to get variables into the params. How do I pass those variables into the custom command? Here is a screenshot of what I got set up so far:

slack error


Solution

  • I think I figured out the only way. You have to POST data instead of GET, and parse the 'text' parameter.