The purpose of this bot is to post on your team's Slack channel on a colleague's birthday 🎂
Every time you run the command rake congratulate
the code will read some files, check who was born at that date, and send a push notification to a Slack channel. You need to create those configuration files, deploy this code to a server, and run that command based on a daily schedule. For that, I used Heroku and its Scheduler add-on.
After you get your ruby env ready...
brew install ruby-build
brew install rbenv
rbenv init
rbenv install
gem install bundler
- Run
bundle install
on you local machine to install dependencies and generateGemfile.lock
. - Get your Incoming Webhook URL from Slack.
- While your at it, give your Slack Bot a name and an icon. That's easier to manage than a configuration file.
- Create/Open a file named
birthdays.txt
. - Write on each line using the following format:
FirstName LastName YYYY MM DD
- Make sure the file is located in the same folder as
congratulate.rb
.
This file will tell the bot who and when should be congratulated.
- Create/Open a file named
configurations.json
. - Fill in the values as you like.
ChannelName
,BotName
,BotEmojiCode
are all optional. They will override Slack's integration configuration, otherwise leave them empty. - Make sure the file is located in the same folder as
congratulate.rb
.
This file will tell the bot how it should behave.
- Do the initial setup at Heroku.
- Upload your code using
git push heroku master
.
- Run
heroku addons:create scheduler:standard
to add the Scheduler add-on to your deploy. - Run
heroku addons:open scheduler
to configure. - Click Add a new job and type
rake congratulate
as the command. - Set frequency to Daily and choose the best Time for your company.
This code was originally created by Tiago Botelho, while he was an intern at jeKnowledge.
It was later revised by Diogo Nunes for EqualExperts. It is now released under the MIT license.