Webhooks provide real-time, push-based notifications when events occur in your Data Mammoth account. Instead of repeatedly polling the API to check for changes, webhooks deliver event data directly to your application as soon as something happens.
How Webhooks Work
Setting Up a Webhook
Via the API
curl -X POST "https://api.datamammoth.com/v1/webhooks" \
-H "Authorization: Bearer dm_key_abc123def456" \
-H "Content-Type: application/json" \
-d '{
"url": "https://yourapp.example.com/webhooks/datamammoth",
"events": ["server.status_changed", "billing.invoice_created"],
"secret": "your_webhook_secret_key"
}'Via the Dashboard
Available Events
Server Events
| Event | Description |
|---|---|
server.created | A new server was provisioned |
server.deleted | A server was permanently deleted |
server.status_changed | Server status changed (started, stopped, etc.) |
server.upgraded | Server plan was upgraded |
server.backup_completed | A backup was created successfully |
server.backup_failed | A backup attempt failed |
Billing Events
| Event | Description |
|---|---|
billing.invoice_created | A new invoice was generated |
billing.invoice_paid | An invoice was paid |
billing.invoice_overdue | An invoice is past due |
billing.payment_failed | An automatic payment failed |
billing.subscription_cancelled | A subscription was cancelled |
Support Events
| Event | Description |
|---|---|
support.ticket_created | A new ticket was opened |
support.ticket_replied | A reply was added to a ticket |
support.ticket_resolved | A ticket was resolved |
support.ticket_closed | A ticket was closed |
Webhook Payload
Each webhook delivers a JSON payload with the event details:
{
"event": "server.status_changed",
"timestamp": "2026-03-17T14:30:00Z",
"data": {
"server_id": "srv_abc123",
"name": "web-production",
"previous_status": "running",
"new_status": "stopped",
"ip": "203.0.113.10"
},
"webhook_id": "wh_xyz789"
}Verifying Webhook Signatures
To ensure webhook requests are genuinely from Data Mammoth, verify the signature included in each request header:
X-Webhook-Signature: sha256=abc123...Verify by computing the HMAC-SHA256 of the request body using your webhook secret:
import hmac import hashlib
def verify_signature(payload, signature, secret): expected = hmac.new( secret.encode('utf-8'), payload.encode('utf-8'), hashlib.sha256 ).hexdigest() return hmac.compare_digest(f"sha256={expected}", signature)
Always verify signatures before processing webhook data to prevent spoofed requests.
Managing Webhooks
List Webhooks
GET /v1/webhooksUpdate a Webhook
PATCH /v1/webhooks/{webhook_id}Delete a Webhook
DELETE /v1/webhooks/{webhook_id}View Webhook Delivery History
GET /v1/webhooks/{webhook_id}/deliveriesThis shows recent delivery attempts, including status codes, timestamps, and any failures.
Webhook Best Practices
200 OK response within 5 seconds. Process the data asynchronously if needed.Retry Policy
If your endpoint returns a non-2xx status code or times out:
- Retries occur with exponential backoff.
- Up to 5 retry attempts over several hours.
- After all retries fail, the delivery is marked as failed.
- You can view failed deliveries in the webhook delivery history.
What to Do Next
- API Overview — Full API reference.
- API Rate Limits & Best Practices — Optimize API usage.
- API Code Examples — Python — Webhook handler examples.
- Server Management API — Server event details.