Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A sample app that uses gauracreative/vaisnava-calendar-data-collection data to send reminders for special events on Telegram.

License

Notifications You must be signed in to change notification settings

mindifest/vcalapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vaiṣṇava Calendar Reminder App

A sample app that uses vaisnava-calendar-data-collection to send reminders for special events on Telegram.

Installation Instructions

  1. Clone the Repository:
    git clone https://github.com/gauracreative/vcalapp.git
    cd vcalapp
  2. Install Node Modules:
npm install
  1. Set Up the Environment File: Copy the example .env.dist file and adjust it with your configuration:
cp .env.dist .env
  • DATA_URL: URL pointing to your calendar data. Consult the vaisnava-calendar-data-collection documentation for details.
  • TELEGRAM_BOT_TOKEN: Create a Telegram bot via BotFather and add the token here.
  • TELEGRAM_CHAT_ID: Add your Telegram group, channel, or personal chat ID where reminders will be sent. Don’t forget to add your bot to the group/channel if applicable.

Usage

  • Run the app manually to send events:

    node index.js today
  • Send tomorrow’s events:

    node index.js tomorrow
  • Send this week’s events:

    node index.js week

Automate with Cron Jobs

You can automate reminders by setting up a cron job. Follow these steps:

  1. Edit Crontab: Open the cron editor:
crontab -e
  1. Add Jobs: Add the following entries to schedule the reminders:
# optional - if your server system time is different (adjust to your own time zone)
TZ=America/Chicago
# Run the script for today's events at 4 AM every day except Sunday
0 4 * * 1-6 cd /path/to/vcalapp && /usr/bin/node index.js today >> cron.log

# Run the script for tomorrow's events at 9 AM every day except Sunday
0 9 * * 1-6 cd /path/to/vcalapp && /usr/bin/node index.js tomorrow >> cron.log


# Run the script for this week's events at 4 AM on Sunday
0 4 * * 0 cd /path/to/vcalapp && /usr/bin/node index.js week >> cron.log

Explanation of Schedule:

  • 0 4 * * 1-6: Executes at 4:00 AM, Monday to Saturday.
  • 0 9 * * 1-6: Executes at 9:00 AM, Monday to Saturday.
  • 0 4 * * 0: Executes at 4:00 AM on Sunday.
  1. Save and Exit: Save the file in your preferred editor (e.g., vim, nano) and exit. The cron jobs are now active.

Additional Notes

  • Ensure the environment file (.env) contains the correct DATA_URL, TELEGRAM_BOT_TOKEN, and TELEGRAM_CHAT_ID.

  • Use node index.js with the appropriate argument to test each functionality before adding it to cron.

  • For advanced scheduling or monitoring, consider using a process manager like PM2.

  • When setting up a cronjob, ensure that the server's timezone is correctly configured. On a Linux server, you can check the current timezone using:

    timedatectl

    To change the timezone, use the following command (replace America/Chicago with your desired timezone):

    sudo timedatectl set-timezone America/Chicago

    This ensures your cronjob runs at the intended local time.

Enjoy sending timely Vaiṣṇava reminders! 🙏

Notification Sample

About

A sample app that uses gauracreative/vaisnava-calendar-data-collection data to send reminders for special events on Telegram.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •