Weather - A Slack Slash Command to access weather information.
We've a version deployed at https://weather.deno.dev for demo. You can use it to create the Slash Command in your Slack workspace.
Go to https://api.slack.com/apps?new_app and create an app. After successful app creation, click on "Slash Commands" section and fill out the details as shown below.
After filling the details click on "Save" button that might at bottom right of the page. That's it!
After the Slack App is setup with the Slash command, run the below command to get weather information of a place.
/weather [<city>]
Additionally, you can avoid passing the city argument to get weather information of a random city from the list.
Follow the steps under OpenWeather section to obtain a
OpenWeather API token and click on the button below to deploy the application.
We use OpenWeather API to obtain weather information.
Here are the steps to obtain a token to communicate with the API:
- Go to https://home.openweathermap.org/api_keys (Login or Sign Up if required)
- Name the key under Create Key and click on Generate
That's it.
You can run the application on your local machine using
deno.
OPEN_WEATHER_TOKEN=<token> deno run --allow-env --allow-net https://raw.githubusercontent.com/denoland/deploy_examples/main/slack/mod.ts
Grab a token at https://openweathermap.org and set the value for the variable.
To be able to use the local version on your Slack workspace, you need to use a tool like ngrok to tunnel Slack requests to the app running on your machine.
- Run
ngrok http 8000(assuming that the application is running on port8000) - Follow the steps under Installation section, but use the https URL output by ngrok for Request URL field.
That's it.

