A Slack bot for weather updates
- Download ngrok and register for a free account here: https://ngrok.com/
- Run your application and obtain the forwarding url.
- Head over to https://api.slack.com/apps to create a new application.
- Create a slash command for the application under the Slash Commands Section.
- Define te scope (i.e allow chat write) and event subscriptions for your app.
- Enter the forwarding url from ngrok under your request url for slash commands and events.
- Once you install your application to your workspace, you will obtain a slack token.
PS: After creating your application you need to add it to at least one channel in a Slack workspace.
- Register for the free plan on https://openweathermap.org/api to get current weather data and obtain the API token.
- Make sure you have at least Python 3.7.0 installed on your machine.
-
Create and activate your virtualenv.
-
Install application requirements using pip
> pip3 install -r requirements.txt
-
Create a configuration file named jumo_config.py and enter your slack token, and open weather map token in there.
-
Import the configuration file to your main application and edit where necessary.
-
Run the app
> python3 jumobot.py
In your slack channel enter:
> /jumo_weather New York
Expected response:
The temperature is 1.66 and it feels like 0.39 degrees in New York.