1st Services Logo
Guides & Tutorials

Automated Backups & Webhook Alerts

Set up scheduled database backups and receive instant status notifications in Slack or Discord.

Automated Backups & Webhook Alerts

1st Services allows you to configure automated snapshot policies for both Cloud VPS and Managed Databases, and trigger instant webhook notifications upon completion or failure.


1. Configure Snapshot Schedules

Use the API to set a daily retention policy:

cURL
curl -X PUT https://api.1st-services.com/v1/databases/db_9918231/backup-schedule \
  -H "Authorization: Bearer $FIRST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "frequency": "daily",
    "hour_utc": 3,
    "retention_days": 14,
    "notify_on_complete": true
  }'

2. Register a Webhook Endpoint

Register your backend or Discord/Slack relay endpoint:

cURL Register Webhook
curl -X POST https://api.1st-services.com/v1/webhooks \
  -H "Authorization: Bearer $FIRST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://api.myapp.com/webhooks/1st-services",
    "events": [
      "database.backup.completed",
      "database.backup.failed",
      "vps.snapshot.completed"
    ],
    "secret": "whsec_994812048129481209"
  }'

3. Webhook Payload Example

When a backup finishes, 1st Services sends an HTTP POST to your endpoint:

{
  "event": "database.backup.completed",
  "data": {
    "backup_id": "bk_881920",
    "database_id": "db_9918231",
    "database_name": "app-db",
    "size_mb": 4250,
    "duration_seconds": 18,
    "completed_at": "2026-08-24T03:00:18Z",
    "download_url_expires_at": "2026-08-24T05:00:00Z"
  }
}
Copyright © 2026