This is a slack bot for recognizing your teammates.
-
Create a new slack app. This app is not distributed, so you will be creating a new app in your workspace instead of adding an existing app to your workspace.
- Create the app in the desired slack workspace.
-
Configure Slack app's bot.
- Go to Features -> App Home.
- Enable "Allow users to send Slash commands and messages from the messages tab".
-
Configure Slack app's permissions.
- Go to Features -> OAuth & Permissions.
- Add the following "Bot Token Scopes":
- app_mentions:read
- channels:history
- channels:read
- chat:write
- emoji:read
- groups:history
- groups:read
- im:history
- im:read
- im:write
- users:read
-
Install Slack app to your workspace.
- Go to Settings -> Basic Information.
- Click "Install to Workspace" button.
- Click "Allow".
-
Create a mongodb cloud atlas cluster (free tier will work fine). This is the database where avocado receipts are stored.
- Create a mongodb cloud atlas account.
- Create a project (just give it a name).
- Create a database in the project.
- select free shared tier M0.
- everything else can be left default, unless you wanna be fancy.
-
Create a Heroku app. This will host the api that slack communicates with. It will be connected to mongodb.
- All you need to do is give it a name and click create.
-
Add config vars to your Heroku app.
- Go to the settings page of your app.
- Click the "Revel Config Vars" button.
- Add the following required config vars:
Key Value BOT_USERID <Your Slack app's bot user ID> MONGODB_URI <Your mongodb connection string> SLACK_TOKEN_BOT <Your Slack app's Bot User OAuth Token> SLACK_TOKEN_VERIFICATION <Your Slack app's Verification Token> - Add the following optional config vars to enable milestone avocado functionality (when the milestone number of avocados have been given, a special message will be posted to the configured channel):
Key Value MILECADO_CHANNEL MILECADO_NEXT <The number of avocados sent to trigger the milestone message e.g. 50000>
-
Deploy the HolyGuacamole API to your Heroku app
- Clone this project.
#navigate to your desired project location cd ~/workspace #clone the project in the current directory git clone https://github.com/designed4device/holy-guacamole.git
- Install the Heroku CLI.
- Deploy using heroku git.
#this will log you in by launching browser heroku login #navigate to your cloned holy-guacamole project cd ~/workspace/holy-guacamole #add the heroku remote to git #replace your-heroku-app-name with your heroku app name heroku git:remote -a your-heroku-app-name #deploy git push heroku master
- Clone this project.
-
Configure Slack app's Event Subscription
- Go to Features -> Event Subscriptions.
- Enable events.
- Set the "Request URL" to
<your Heroku app url>/events- Your Heroku app url can be found in the "Domains" section of your Heroku app settings.
- e.g "https://my-heroku-app.herokuapp.com/events"
- Subscribe to bot events:
- app_mentions
- member_joined_channel
- message.channels
- message.groups
- message.im
- team_join
- user_change
- Click "Save Changes" button.
- Click the "Connect" button on your mongodb database deployment (DEPLOYMENT -> Databases).
- Click "Allow connection from anywhere", then "Add IP Address". Optionally, you can instead configure to only allow access from the appropriate slack IP address.
- Enter a secure username and password and click create (Be sure to save your username and password somewhere secure, you will need it later).
- Click "Choose a connection method".
- Click "Connect your application".
- Select "Java" from the "DRIVER" dropdown.
- Select "4.3 or later" from the "VERSION" dropdown.
- Copy the connection string and replace with the password you created previously.
- While viewing your slack workspace from a browser, open up a chat with your app (In the left menu where your channels and messages are, go to Apps -> Your App Name).
- Click on the app's name at the top.
- Copy the "Member ID" from the dialog that opened in previous step. It should look something like this "U028E073GR0".
- In your Slack App's configuration go to Features -> OAuth & Permissions.
- Copy the "Bot User OAuth Token" from this page.
- In your Slack App's configuration go to Settings -> Basic Information.
- Copy the "Verification Token" from the "App Credentials" section on this screen.