This project is a simple example of creating a serverless/openwhisk-based function to be invoked by a Slack slash command. For this example, we will be using a free API to get a random famous quote via Mashape.
- Node (>=6.x)
- npm
- serverless framework
- IBM Bluemix Account (free for 30 days)
wsk
cli utility
In order to deploy this project to OpenWhisk, you will need to follow the quickstart guide.
You will need a Mashape API key, signup and export your key:
$ export MASHAPE_API_KEY=<your-mashape-api-key>
Create a new Slack slash command for your Slack team. Make note of the secret token. Set the method to GET
and keep the window open, we will fill in our OpenWhisk web action's URL after deployment.
$ export SLACK_TOKEN=<your-slack-slash-cmd-token>
To deploy the project after OpenWhisk setup is complete:
$ make deploy
Go back to the Slack slash command editing page and insert the URL for your web action.