A lightweight Telegram bot built using Telethon, designed to send daily birthday reminders directly to your Telegram chat. Never forget a loved one's special day again!
- For the Telethon MTProto version: Use the
master
branch. - For the Bot API version: Switch to the
main
branch.
- Customizable Birthday List: Manage birthdays in the
birthdays.json
file. - Daily Notifications: Automatically checks and sends reminders at a specific time.
- Age Calculation: Automatically includes the recipient's age if the birth year is provided.
- Error Handling: Graceful error messages for missing files, invalid JSON, or Telegram issues.
- The bot reads the
birthdays.json
file for upcoming birthdays. - If a match is found, it formats a message and sends it to your Telegram chat.
- Runs daily using a scheduler (e.g., GitHub Actions, Cron jobs).
This section will guide you on setting up a scheduled cron job using GitHub Actions to run the Birthday Notifier bot automatically every day.
The GitHub Actions workflow runs the bot daily at 10:00 PM UTC to check for birthdays and send notifications. The job is defined in the .github/workflows/birthday_notifier.yml
file.
The bot is set to run daily at a specific time using the cron
syntax:
on:
schedule:
- cron: '0 22 * * *' # Runs daily at 10:00 PM UTC
You can modify the cron expression if you need the bot to run at a different time.
You can also manually trigger the workflow via GitHub's Workflow Dispatch option:
on:
workflow_dispatch: # Allows manual triggering of the workflow
-
Checkout the code
Ensure you have a directory
.github/workflows/
in your repository. Inside this directory, create or modify the filebot.yml
(change it frombot dot yml
tobot.yml
). -
Set up environment variables
Before running the workflow, make sure to add the following environment variables to your GitHub repository's Settings > Secrets. These variables are used to securely store sensitive information like your Telegram bot credentials.
TELEGRAM_BOT_TOKEN
: Your Telegram bot token.TELEGRAM_CHAT_ID
: The chat ID where the notifications will be sent (either personal or group chat).
You can add these secrets by navigating to Settings > Secrets > New repository secret.
Now, your bot will automatically check for birthdays and notify you every day at the set time! 🎉
- Clone the Repository
git clone https://github.com/ankit-chaubey/birthday-notifier.git cd birthday-notifier
Define these in your system or a .env file:
TELEGRAM_BOT_TOKEN – Your Telegram bot token.
TELEGRAM_CHAT_ID – Chat ID to receive notifications.
pip install -r requirements.txt
python birthday_notifier.py
.
├── birthdays.json # JSON file storing birthday data
├── birthday_notifier.py # Main script for notifications
├── requirements.txt # Python dependencies
└── README.md # Documentation
[
{ "name": "Ankit", "date": "2002-06-12" },
{ "name": "John", "date": "1998-03-15" },
{ "name": "Alice", "date": "2000-11-24" }
]
Feel free to open issues or submit pull requests. Let’s make this bot even better together!
This project is licensed under the MIT License.
Start celebrating birthdays like a pro! 🎂