Overview
The WhatsApp Attendance Bot requires three essential environment variables to connect to the Ultramsg API and send messages to your designated WhatsApp group. These variables must be configured as GitHub Secrets for secure storage.Required Environment Variables
Your Ultramsg instance identifier. This is obtained from your Ultramsg dashboard after creating an instance.Usage in code: Used to construct the API endpoint URL:Example format:
instance12345Your Ultramsg API authentication token. This token authorizes API requests to send messages.Usage in code: Passed as a parameter in the API payload:Example format:
abcdef123456789The WhatsApp group ID where attendance messages will be sent. This must include the country code and end with Example format:
@g.us for groups.Usage in code: Specifies the message recipient:[email protected]Setting Up GitHub Secrets
Configure INSTANCE_ID
- Name:
INSTANCE_ID - Value: Your Ultramsg instance ID (e.g.,
instance12345) - Click Add secret
Configure GROUP_ID
Repeat step 3 and add:
- Name:
GROUP_ID - Value: Your WhatsApp group ID (e.g.,
[email protected]) - Click Add secret
How Variables Are Used
The GitHub Actions workflow (.github/workflows/main.yml) injects these secrets as environment variables when running the bot:
bot.py) retrieves these values using os.getenv():
Verification
After setting up your secrets, you can test the configuration by manually triggering the workflow using the Actions tab in your GitHub repository.
Testing Your Configuration
- Go to the Actions tab in your repository
- Select the “Registro WhatsApp Automático” workflow
- Click Run workflow > Run workflow
- Check your WhatsApp group for the attendance message
Security Best Practices
Rotate Tokens Regularly
Update your TOKEN periodically in both Ultramsg and GitHub Secrets to maintain security.
Limit Repository Access
Only grant repository access to trusted collaborators who need to manage the bot.
Monitor Usage
Regularly check your Ultramsg dashboard for unexpected API usage.
Use Read-Only When Possible
Grant collaborators read-only access unless they specifically need to modify secrets.
Troubleshooting
Common Issues
Secret not found error- Verify that the secret name exactly matches the variable name in the workflow file (case-sensitive)
- Ensure you’ve saved the secret after entering the value
- Double-check that you copied the complete token from Ultramsg without extra spaces
- Verify the token is still active in your Ultramsg account
- Confirm the GROUP_ID format includes
@g.usfor groups - Verify your Ultramsg instance is connected and active
Next Steps
Scheduling
Configure when your attendance messages are sent
Ultramsg Setup
Learn how to obtain your Ultramsg credentials