/SlackBirthdayBot

Birthday Bot for Slack to congratulate people on their birthdays.

Primary LanguageRubyMIT LicenseMIT

B-DAY-BOT: Birthday Slack Bot

BotAvatar

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.

Ready

After you get your ruby env ready...

brew install ruby-build
brew install rbenv
rbenv init
rbenv install
gem install bundler
  1. Run bundle install on you local machine to install dependencies and generate Gemfile.lock.
  2. Get your Incoming Webhook URL from Slack.
  3. While your at it, give your Slack Bot a name and an icon. That's easier to manage than a configuration file.

Set

Configure your birthdays

  1. Create/Open a file named birthdays.txt.
  2. Write on each line using the following format: FirstName LastName YYYY MM DD
  3. 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.

Configure your bot

  1. Create/Open a file named configurations.json.
  2. Fill in the values as you like. ChannelName, BotName, BotEmojiCode are all optional. They will override Slack's integration configuration, otherwise leave them empty.
  3. Make sure the file is located in the same folder as congratulate.rb.

This file will tell the bot how it should behave.

Go

Deploy (to Heroku)

  • Do the initial setup at Heroku.
  • Upload your code using git push heroku master.

Schedule (on Heroku Scheduler)

  • 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.

Acknowledgments

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.