Overview
The WhatsApp Attendance Bot uses GitHub Actions cron schedules to automatically send attendance messages at specific times. Understanding cron syntax and UTC timezone conversion is essential for configuring the bot to run at your desired local times.GitHub Actions always uses UTC timezone for cron schedules. You must convert your local time to UTC when configuring schedules.
Current Schedule Configuration
The bot is currently configured to send messages twice daily on weekdays:main.yml
Scheduled Times
Morning Check-in
UTC: 15:00 (3:00 PM)
CST/Mexico: 9:00 AM
Days: Monday - FridaySends: “Aldo Tolentino \n Entrada \n 9:00 AM”
CST/Mexico: 9:00 AM
Days: Monday - FridaySends: “Aldo Tolentino \n Entrada \n 9:00 AM”
Afternoon Check-out
UTC: 21:00 (9:00 PM)
CST/Mexico: 3:00 PM
Days: Monday - FridaySends: “Aldo Tolentino\n Salida\n 3:00 PM”
CST/Mexico: 3:00 PM
Days: Monday - FridaySends: “Aldo Tolentino\n Salida\n 3:00 PM”
Understanding Cron Syntax
Cron expressions consist of five fields that specify when to run:Example Breakdown
- 0: At minute 0 (top of the hour)
- 15: At hour 15 (3:00 PM UTC)
- *: Every day of the month
- *: Every month
- 1-5: Monday through Friday (1=Monday, 5=Friday)
Timezone Conversion Guide
Since GitHub Actions uses UTC, you must convert your local time to UTC. Here’s how the current schedule converts:Mexico/Central Standard Time (CST/UTC-6)
Calculate UTC Offset
CST is UTC-6, meaning CST is 6 hours behind UTC.Formula: UTC = Local Time + 6 hours
Convert to UTC
9:00 AM CST + 6 hours = 15:00 UTC (3:00 PM)3:00 PM CST + 6 hours = 21:00 UTC (9:00 PM)
Common Timezone Conversions
Use this table to convert common timezones to UTC for your cron schedules.
| Timezone | Offset | 9:00 AM Local | 3:00 PM Local | 9:00 AM in UTC | 3:00 PM in UTC |
|---|---|---|---|---|---|
| CST (Mexico) | UTC-6 | 9:00 AM | 3:00 PM | 15:00 | 21:00 |
| EST (US East) | UTC-5 | 9:00 AM | 3:00 PM | 14:00 | 20:00 |
| PST (US West) | UTC-8 | 9:00 AM | 3:00 PM | 17:00 | 23:00 |
| GMT (UK) | UTC+0 | 9:00 AM | 3:00 PM | 09:00 | 15:00 |
| CET (Central Europe) | UTC+1 | 9:00 AM | 3:00 PM | 08:00 | 14:00 |
| IST (India) | UTC+5:30 | 9:00 AM | 3:00 PM | 03:30 | 09:30 |
How Message Content Is Determined
The bot uses UTC hour to determine whether to send a check-in or check-out message:bot.py
- If UTC hour < 18 (before 6:00 PM UTC): Send “Entrada” (Check-in) message
- If UTC hour >= 18 (6:00 PM UTC or later): Send “Salida” (Check-out) message
Customizing Your Schedule
Change Running Times
To modify when the bot runs, edit.github/workflows/main.yml:
Add Weekend Runs
To include Saturday and Sunday:Add Additional Check-ins
For a third daily message (e.g., lunch break):If you add additional schedules, you’ll need to modify the message logic in
bot.py to send appropriate content for each time.Monthly or Specific Date Runs
Manual Workflow Execution
The workflow includesworkflow_dispatch to allow manual triggering:
Running Manually
Run Workflow
Click the Run workflow dropdown button, then click Run workflow to execute immediately.
Cron Schedule Reliability
Typical delay: 3-10 minutes during peak times Best practices:- Don’t rely on exact second-precision timing
- Schedule critical tasks with buffer time
- Use manual dispatch for time-sensitive tests
Testing Your Schedule
Verify Cron Expression
Use online tools to validate your cron syntax:- crontab.guru - Interactive cron expression explainer
- crontab-generator.org - Visual cron schedule builder
Test Before Committing
- Use the manual workflow dispatch to test immediately
- Check workflow logs for execution time and output
- Verify the message appears in your WhatsApp group
- Confirm the message content matches the expected check-in/check-out
Troubleshooting
Workflow Not Running
Check these common issues:- Ensure the schedule is in the
mainor default branch - Verify cron syntax is valid (no syntax errors)
- Confirm the repository has Actions enabled (Settings > Actions > General)
- Check if you’ve reached GitHub Actions usage limits
Wrong Message Time
Possible causes:- Incorrect UTC conversion (recalculate your timezone offset)
- Daylight Saving Time not accounted for
- GitHub Actions delay (check actual execution time in logs)
Wrong Message Content
Solution:- Review the hour threshold in
bot.py:13 - Adjust the
ahora_hora < 18condition for your timezone - Test with manual dispatch at different times
Next Steps
Environment Variables
Configure required credentials for the bot
Customization
Modify message content and formatting