A slack BOT that simply reminds Birthdays the funny way with animated random Giphy GIFs... for free.
The goal of this project is to make a "BOT" that wishes happy birthday, on a dedicated channel.
NB : As integration is made thanks to a Webhook, you don't have to add an app to your Slack Team... good for people who are using free plans on Slack.
To make this integration operational, all you need is :
- A slack Webhook url dedicated to the
birthdays
channel (private or public) - A Giphy API token
- A place to run your daily Job (Travis cron jobs is a good place to do that so all your stuff is in the cloud)...but you can run it wherever you like
- A csv file that contains birthdays data (please take a look at
data/birthdays.csv
to get a running example) - A
maven
runtime (to make things easier to run ...)
All of these items are available for free.
It's all in data/birthdays.csv
:
username
anddob
are mandatory,username
must be unique in the csv (the slack username, without the@
)dob
is in formatYYYY-MM-DD
If your are using default csv file (data/birthdays.csv
), just run :
mvn exec:java -DgiphyApiKey=YOUR_GIPHY_API_KEY -DslackWebhookUrl=YOUR_SLACK_WEBHOOK_URL
If you want to use a custom csv file use the fully qualified command line :
mvn exec:java -DcsvFileName=CSV_FILENAME_PATH -DgiphyApiKey=YOUR_GIPHY_API_KEY -DslackWebhookUrl=YOUR_SLACK_WEBHOOK_URL
- First, install the
Incoming WebHooks
app : https://slack.com/apps/A0F7XDUAZ-incoming-webhooks - Configure it to target the
#birthdays
channel - Keep the url and keep it secret
You can set in up localy on your workstation, on a server but...the best way is to deploy it on the cloud...
and Travis CI can help, see dedicated Travis instruction in DEPLOY_ON_TRAVIS.md
for that.
To better manage birthdays greetings, you can create a dedicated branch and cron job only on that branch ;-p ...hence you are ready to perform PR on the project.
Take care to schedule cron in the middle of the morning to get the best effect : it's much more fun to get a live slack than to discover on when you arrive at the office : nothing beats the Slack "tac tac" with a punching GIF !
https://www.linkedin.com/pulse/birthdays-bots-slack-travis-ci-cron-jobs-all-free-fun-adrien-sales/
- Thanks to Gabriel Pedro for his very efficient slack-webhook library, and very kind support on my features requests
- Thanks to Mathias Markl for his Giphy4J Giphy lib