Breezometer Slack Bot
Get Air quality directly in Slack. Using Breezometer data.
Command to post in a Slack channel
breez San Francisco
It gives you the air quality level and recommendations.
🐣for kids ❤️for health 🏠for indoor ⛺️for outdoor ⚽️for sport
Failed request for a city not supported
- Breezometer API account, create one
- Slack organization, create one
- APItools account, create one
- Time :)
1. Create outgoing webhook
Outgoing webhook is used to "listen" what's happening on channels.
To create a new one go on
On the next page you will select on which channel of your organization you want to bot to be active. And the triggered words. Triggered words are the words that will make the bot react. In our case breez.
At the bottom of the page you can give a cute name to your bot as well as an avatar. We will come back later to this page to fill the other fields.
2. Create incoming webhook
Incoming webhook is used to send data to channels.
Again we go on
And create an
Define on which channel you want to post, change the name of the bot and it's icon. All these could be overide later.
Webhook URL somewhere we will need it later to send a
POST request and send data to slack.
Using APItools is a great way to avoid maintaining servers for something as simple as webhooks. It's also free to use.
Create a new service with the API URL
This service will be used to make all the requests to Breezometer API.
We don't have any middleware code for this service.
Anytime our triggered word is used in a channel, slack will make a request to an URL. We want to URL to be an API service. This service will handle the outgoing webhook request from slack.
Use the echo-api as API URL
Copy APItool URL that should look like
Go back to the Outgoing webhook config page you previsouly created. Pasted the APItools URL in the URLs field.
On APItools, on your newly created service, go in the pipeline and paste the code found in the file
hook.lua of this repo.
On this code couple of placeholders have to be changed:
SLACK_HOOK_URL with the Slack incoming webhook URL
BREEZ_APITOOLS_URL with the APItools URL for breezometer service
BREEZ_API_KEY with your personal API key from Breezometer