An example Slapp Slack App using Firebase as the persistence layer. A primary goal of this repo is to serve as an example of you you might integrate a custom persistence layer w/ Slapp.
Expects the following environment variables:
PORT- port to start http server on - defaults to3000DOMAIN- domain name - defaults to pulling from host headers on requestsSLACK_VERIFY_TOKEN- Your Slack App's verify tokenSLACK_CLIENT_ID- Your Slack App's Client IDSLACK_CLIENT_SECRET- Your Slack App's Client SecretFIREBASE_DB_URL- Your Firebase project's Database URL
Also expected is a Firebase Service account key file located in the root of the project, named firebase.json.
You'll need to setup a new Slack App and add a Bot User, as well as enable Event Subscriptions. Pick any username for your Bot User, and for your Event Subscrition, use the following details:
- Request URL:
https://<your-domain>/slack/event - Add the following Bot Events
message.channelsmessage.groupsmessage.immessage.mpim
A Firebase project is also required. Slack Team data from the "Add to Slack" OAuth flow, as well as conversation state is stored there. Make sure to add your service account key file as firebase.json and set your FIREBASE_DB_URL environment variable.
Once you have your app running, if you visit the root, https://<your-domain>/ it will render a page with an "Add to Slack" button you can use to add it to one of your Slack teams and start sending it messages.
Try asking the bot for help in a direct message
Try changing the messages the bot is listening for to get a feel for how things work by looking in lib/slapp.js
