Birthday wishes on Flock

Our developers love automating frequently performed tasks on Flock. But what if they could also help others with it? So this time around, they’re making the HR department’s job easier.

One of the many responsibilities of HR is to send birthdays wishes to employees in a common group on Flock. And truth be told, that’s how we remember their birthdays too.

Problems with this approach, you ask?

  • The mental ability to remember birthdays
  • Adding a daily task to check out birthdays on current day
  • In case the HR isn’t available on your birthday, who would wish you at work?

Let’s solve these problems for you.

The solution would require the following three components:


For a basic setup, one can save birthdays of all employees in an excel sheet. A simple script can be written to get today’s birthdays by parsing the sheet. Believe me when I say ‘simple’, it really is simple!

#!/usr/bin/env ruby
require ‘roo’
WEBHOOK = “<flock_incoming_webhook>”
def select_birthdays_today_in_xlsx(filename, sheet_index)
xlsx =
current_date = Date.parse(

xlsx.sheet(sheet_index).select do |row|
if row[1].is_a?(Date)
birthday = row[1]
birthday.month == current_date.month && ==
end do |row|
def get_random_birthday_wish_text
wishes =‘birthday_wishes_list.txt’).split(“\n”)
wishes[rand wishes.length]
def wish person_name
text = “Hey #{person_name},\n#{get_random_birthday_wish_text}”
send_text WEBHOOK, text
def send_text(webhook, text)
`curl -X POST -d ‘{“text”:”#{text}”}’ -H “Content-Type:application/json;charset=UTF-8” #{webhook}`
def send_wishes
names = select_birthdays_today_in_xlsx “./birthdays.xlsx”, 0 { |name| wish name }

Basic assumptions for this script:

  • birthdays.xlsx : File containing all birthdays in the following format:
| yatin | 5-Aug    |
  • birthday_wishes_list.txt: Just to make this script look more human, as the same wishing message to everyone would be so robotic. A nice touch to this would be to select a random wish from a list of birthday wishes(approved ones only).

Here is one sample list of birthday wishes one can use.

One can form similar birthday wishes using this script:

Hey {name}, Wishing you Happy Birthday. Have a blast !!!

Incoming Webhook:

Incoming webhooks allow you to push your data into Flock in real time.

Login to and add new incoming webhook. An incoming webhook would look like this:<validation_token>

Visit :

Cron job

A cron job is a Linux command for scheduling a task to be executed sometime in the future. This is normally used to schedule a job that is executed periodically — for example, to send out a notice every morning.

Cron job can be used to invoke the script everyday on a fixed time. For example to send wishes every morning at 9 am, please follow these steps:

Step 1:

$ crontab -e

Step 2: Add this to file

0 9 * * * sh <path_to_script>

For this, you would need an additional step to change executable permissions for the script.

$ chmod +x <path_to_script>

What’s the scope of improvement?

  • Maintaining a list: You can also integrate Google calendar instead of an excel sheet to retrieve birthdays. This would require more effort, but is undoubtedly achievable.
  • In case the HR has enough budget, you could also order a cake. Not sure, if there is an API to order cakes automatically, but in this case, even a simple reminder to the relevant person would suffice.

Signing off by wishing you, in case it’s your birthday today.


-Authored by Yatin Sarbalia, Project lead (iOS) at Flock