This bot automatically sends messages to a Slack channel when:
- An employee has a birthday today 🎂
- An employee is celebrating their work anniversary 🎉
It also fetches a professional-looking Happy Birthday GIF using the Giphy API.
✅ Sends automated messages to a Slack channel.
✅ Checks for birthdays and work anniversaries every day at 9 AM.
✅ Fetches high-quality birthday GIFs from Giphy.
✅ Runs automatically without requiring manual execution.
git clone https://github.com/your-repo/slack-birthday-bot.git
cd slack-birthday-botyarn installInside the project folder, create a .env file and add the following environment variables:
SLACK_TOKEN=xoxb-your-slack-bot-token
GIPHY_API_KEY=your-giphy-api-key
SLACK_CHANNEL_ID=your-slack-channel-id- SLACK_TOKEN → Your Slack bot token (
xoxb-...) - GIPHY_API_KEY → Your Giphy API key
- SLACK_CHANNEL_ID → The Slack channel ID where messages should be sent
To start the bot manually:
yarn ts-node bot.tsThe bot will:
- Immediately check birthdays and anniversaries upon startup.
- Schedule itself to run at 9 AM daily to send messages.
To keep the bot running in the background:
yarn global add pm2
pm2 start bot.ts --interpreter=ts-node
pm2 save
pm2 startupCheck logs:
pm2 logs botStop the bot:
pm2 stop botDeploy it on a server (e.g., AWS, DigitalOcean, Vultr) and use pm2 to keep it running.
Convert it into an AWS Lambda or Google Cloud Function with a scheduled trigger.
Keep the script running in the background on your machine.
Bot is not sending messages?
- Check if the bot has
chat:writepermissions in Slack. - Ensure the
.envfile has the correct tokens. - Verify the channel ID is correct (
SLACK_CHANNEL_ID).
GIFs are not loading?
- Make sure your Giphy API key is valid.
- Giphy API may be rate-limiting requests—try again later.
✅ Fetch GIFs based on user preferences.
✅ Expand database to use a proper backend.
✅ Allow custom message templates.
[gab]
Feel free to contribute, improve, or fork this project! 🚀