A slackbot which takes in a zip code and displays the conditions for that location.
- Create an account on Heroku.
- Create a developer API key on Weather Underground.
- Make sure you have Node and Git installed. You can use Homebrew to install them.
brew install node git
Once you have the 3 files setup, jump to weather-slackbot folder and install all the dependencies.
npm i
After npm is finished installing dependencies, run:
node index.js
The app is running. Visit http://localhost:9001. You should see “Running!!”. It is now listening for requests at port 9001.
Now we have to deploy this code to Heroku where Slack can send requests. If you haven’t signed up for a Heroku account yet, do it now. Then install the heroku toolbelt, login, create the app, and finally push it. Follow and run these commands:
brew install heroku-toolbelt
heroku login
heroku create
git push heroku master
To check if it is working, type:
heroku open
and you see see the “Running!!” message. Now go ahead and add the Weather Underground API key under WU_ACCESS
heroku config:add WU_ACCESS=[your API key]
Check the Heroku dashboard to see if your app is there.
Open slack, go to your team’s custom integration page and add a slash command.
Read this blog post for a better understanding