Aiforsite Alerts User Guide
Complete guide to monitoring, alerting, and notifications with Aiforsite Alerts.
1. Getting Started
Aiforsite Alerts is a multi-channel alerting platform that helps you monitor your services and get notified when things go wrong.
Key Features
- Alert Ingestion - Receive alerts via webhook from any system
- Health Monitors - HTTP endpoint and script-based health checks
- Heartbeat Monitoring - Dead man's switch for cron jobs and backups
- AI Watchers - Monitor web pages for changes with AI analysis
- Status Page - Public status page for your services
- Multi-channel Notifications - Email, SMS, Slack, WhatsApp, Webhooks
2. API Keys
API keys are used to authenticate requests to the Aiforsite Alerts API.
Creating an API Key
- Go to Admin → API Keys
- Click "Add API Key"
- Enter a name and select scope
- Important: Copy the key immediately - it's only shown once!
Scopes
| Scope | Permissions |
|---|---|
full | All API operations |
ingest | Send alerts only |
read | Read data only |
Using API Keys
# Header authentication (recommended)
curl -H "Authorization: ApiKey al_xxxx_xxxxxx" \
https://alerts.aiforsite.io/api/v1/...
# Bearer token format also works
curl -H "Authorization: Bearer al_xxxx_xxxxxx" \
https://alerts.aiforsite.io/api/v1/...
3. Sending Alerts
Send alerts to Aiforsite Alerts from any system using our ingest API.
Basic Alert
curl -X POST https://alerts.aiforsite.io/api/v1/ingest/ \
-H "Authorization: ApiKey YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"alerts": [{
"name": "High CPU Usage",
"message": "Server CPU is at 95%",
"level": "warning"
}]
}'
Alert Levels
| Level | Use Case |
|---|---|
info | Informational messages |
warning | Something needs attention |
alarm | Action required |
critical | Immediate action required |
Full Payload Example
{
"project": {
"id": "proj-123",
"name": "Production Server"
},
"alerts": [{
"name": "Database Connection Failed",
"message": "Cannot connect to PostgreSQL",
"level": "critical"
}],
"device": {
"name": "web-server-01",
"serial": "ABC123"
}
}
4. Health Monitors
Automatically check if your services are healthy.
HTTP Monitors
Check if an HTTP endpoint is responding correctly.
- URL to check
- Expected status code (default: 200)
- Response must contain specific text
- Maximum response time
- Check interval (5 min to 24 hours)
Script Monitors
Run custom Python or Bash scripts to check anything.
#!/bin/bash
# Check disk usage
USAGE=$(df / | tail -1 | awk '{print $5}' | sed 's/%//')
if [ $USAGE -gt 90 ]; then
echo "Disk usage critical: ${USAGE}%"
exit 1
fi
echo "Disk OK: ${USAGE}%"
exit 0
Exit code 0 = OK, non-zero = FAIL
Alert Settings
- Alert after N failures - Only alert after consecutive failures (default: 2)
- Recovery alerts - Get notified when service recovers
5. Heartbeat Monitoring
Monitor cron jobs, backups, and scheduled tasks. Alert if they don't run on time.
How It Works
- Create a heartbeat with expected interval
- Get unique ping URL
- Add ping to your script/cron job
- Get alerted if ping is missing
Example: Backup Script
#!/bin/bash
# backup.sh
# Run backup
pg_dump mydb > backup.sql
# Ping heartbeat on success
curl -s https://alerts.aiforsite.io/api/v1/heartbeat/YOUR_TOKEN/
Crontab Example
# Run backup daily at 2 AM, ping heartbeat on success
0 2 * * * /opt/scripts/backup.sh && curl -s https://alerts.aiforsite.io/api/v1/heartbeat/YOUR_TOKEN/
Settings
- Interval - How often the ping is expected
- Grace period - Extra time before alerting
6. AI Watchers
Monitor web pages and get alerted when specific conditions are met using AI analysis.
Use Cases
- Concert tickets become available
- Product comes back in stock
- Price drops below threshold
- Job posting appears
- News article is published
Creating a Watcher
- Go to Admin → Watchers
- Enter the URL to monitor
- Write a condition in plain language:
"Alert me when concert tickets become available"
"Notify me if price drops below 100€" - Set check interval
- Select notification channels
How It Works
- Aiforsite Alerts fetches the page periodically
- Compares content with previous version
- AI analyzes if your condition is met
- Sends notification if condition is true
Note: Requires OPENAI_API_KEY environment variable.
7. Status Page
Public status page showing the health of your services.
Features
- Real-time status of monitors and heartbeats
- Uptime percentages
- Response time metrics
- Incident history
- Custom branding (logo, colors)
- Auto-refresh every 60 seconds
Setup
- Go to Admin → Status Pages
- Create a new status page
- Choose a URL slug (e.g.,
status) - Select monitors and heartbeats to display
- Share URL:
https://alerts.aiforsite.io/status/your-slug/
JSON API
GET /api/v1/status/your-slug/
{
"title": "My Company Status",
"overall_status": "operational",
"monitors": [
{"name": "API", "status": "ok"},
{"name": "Website", "status": "ok"}
],
"heartbeats": [
{"name": "Daily Backup", "status": "healthy"}
]
}
8. Notification Channels
Configure where and how you receive alerts.
Supported Channels
| Channel | Configuration |
|---|---|
| Email address | |
| SMS | Phone number (requires Twilio) |
| Phone number (requires Twilio) | |
| Slack | Webhook URL |
| Microsoft Teams | Webhook URL |
| Custom Webhook | URL + headers |
Email Setup (Gmail)
- Go to Admin → Email Settings
- Select "Gmail SMTP" provider
- Enter your Gmail address
- Create an App Password at Google Account
- Enter the App Password
Slack Setup
- Create an Incoming Webhook in Slack
- Go to Admin → Notification Channels
- Add new channel, select "Slack"
- Paste the webhook URL
Need Help?
Contact support or check our GitHub repository for issues and updates.