Skip to content

dreth/BdayReminderBot

Repository files navigation

Telegram Birthday reminder bot

birthday reminder bot to run as a simple cron job with a CSV file containing birthdays because i always forget birthdays

  1. Create a telegram bot using @botfather and get your api key

  2. Create venv

python3 -m venv ./bdaychecker
  1. Activate the new env
source ./bdaychecker/bin/activate
  1. Install requirements
pip install -r requirements.txt

As well as the python-telegram-bot library version v20.x:

pip install python-telegram-bot -U --pre
  1. Add telegram API to the .env file, I provided a template, but this command will create a new one with the needed environment variables, just replace APIKEY with your telegram bot API key and CHATID with your chat ID (this thread in stackoverflow details how you can get that)
echo -e "TELEGRAM_BOT_API_KEY=\"APIKEY\"\nYOUR_CHAT_ID=\"CHATID\"" > .env && rm .env.template
  1. Create a csv file with your birthdays in the format shown below.

Example:

name year month day
Carlos 1967 11 7
Michael 1983 3 2
George 1988 9 15

You can skip the year if you don't know it, but the name, month and day must be populated, otherwise that row will be skipped.

echo -e "name,year,month,day\n" > birthday_list.csv 
  1. Add a cron job to run this once a day every day, when it runs, you should receive a message from the bot if there's a birthday
crontab -e

And add (change the 6 with whatever hour you want this to run at):

0 6 * * * /path/to/cloned/repo/bdaychecker/bin/python /path/to/cloned/repo/check_bdays.py

I added a bash script to the root of the repo (initial_setup.sh) which runs all commands before step 6, you can run this script with source initial_setup.sh or . initial_setup.sh in bash.

About

Simple python script to run as a daily cron job that pushes birthday reminders as a message to a telegram bot

Topics

Resources

License

Stars

Watchers

Forks