Overview
GitHub Actions allows you to run the WhatsApp attendance bot automatically on a schedule without any server infrastructure. This guide walks you through setting up the workflow.Workflow Structure
The bot uses a GitHub Actions workflow file located at.github/workflows/main.yml. Here’s the complete configuration:
main.yml
Understanding the Schedule
Cron Syntax
The workflow uses cron expressions to schedule executions:
0 15 * * 1-5- Runs at 15:00 UTC (9:00 AM CST) Monday through Friday0 21 * * 1-5- Runs at 21:00 UTC (3:00 PM CST) Monday through Friday
Cron format:
minute hour day-of-month month day-of-weekGitHub Actions uses UTC timezone by default, so you’ll need to convert your local time.Time Zone Conversion
Calculate your UTC offset:
| Timezone | Offset | 9:00 AM Local | 3:00 PM Local |
|---|---|---|---|
| CST (Mexico) | UTC-6 | 15:00 UTC | 21:00 UTC |
| PST | UTC-8 | 17:00 UTC | 23:00 UTC |
| EST | UTC-5 | 14:00 UTC | 20:00 UTC |
| GMT | UTC+0 | 09:00 UTC | 15:00 UTC |
Adding GitHub Secrets
The workflow requires three secrets to authenticate with the UltraMsg API:Navigate to Settings
- Go to your GitHub repository
- Click Settings tab
- In the left sidebar, expand Secrets and variables
- Click Actions
Add Required Secrets
Click New repository secret and add each of these:
Secrets are encrypted and only exposed to the workflow during execution. They never appear in logs.
Workflow Jobs Breakdown
Environment Setup
The workflow runs onubuntu-latest and performs these steps:
- Checkout code - Downloads your repository code using
actions/checkout@v3 - Set up Python - Installs Python 3.9 using
actions/setup-python@v4 - Install dependencies - Runs
pip install requeststo install the required library - Execute script - Runs
python bot.pywith environment variables from secrets
Environment Variables
The secrets are injected as environment variables:bot.py using:
Modifying the Schedule
To change when the bot runs, edit the cron expressions:- Different Times
- Include Weekends
- Single Daily Check-in
Monitoring Workflow Executions
To view workflow runs:- Go to the Actions tab in your repository
- Click on a workflow run to see details
- Expand the Execute Script step to see the bot’s output
- Check for the status code and API response