This provides a simple karmabot that is built on Lumen. Since we are only returning JSON and requests are not exactly cached, we queue up the requests and process them afterwards. Simple approach.
At some point in its life, it will also have testing. However, I need to figure out how to do that in Laravel/Lumen so this is not yet ready.
ALLOWED_SLACK_PROCESSING_TOKENS
: This consists of tokens that will filter out to make sure the requests are only coming in from the right intent places.
SLACK_OAUTH_ACCESS_TOKEN
: The oauth token is needed to connect to slack and get list of users, send message to channel.
You need to enable the following features:
- Incoming Webhooks
- OAuth and Permissions
- Event Subscriptions
- Bot Users
You need to create a bot with the following oauth privileges:
bot
chat:write:bot
incoming-webhook
users:read
You also need to subscribe the bot to the following event subscriptions:
app_mention
message.channels
message.groups
(this one is optional and really only use the bot in private groups).
To setup weather feature:
- Go to https://openweathermap.org/ and get an API key.
- Add the key to WEATHER_API_KEY in the .env file.
To setup Air Quality feature:
- Go to https://docs.airnowapi.org/ and get an API key.
- Add the key to AIR_API_KEY in the .env file.
Laravel Lumen is a stunningly fast PHP micro-framework for building web applications with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Lumen attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as routing, database abstraction, queueing, and caching.
Documentation for the framework can be found on the Lumen website.
If you discover a security vulnerability within Lumen, please send an e-mail to Taylor Otwell at [email protected]. All security vulnerabilities will be promptly addressed.
The Lumen framework is open-sourced software licensed under the MIT license.