Alert Destination

Generic Webhooks

Send database audit alerts to any HTTP endpoint with customizable payloads, authentication, and headers. Build custom integrations with your existing tools and workflows.

Custom Payloads

Use Handlebars templates to format alert data exactly how your endpoint expects it.

Multiple Auth Methods

Support for Basic, Bearer, API Key, and HMAC signature authentication.

Automatic Retries

Exponential backoff retries ensure reliable delivery even when endpoints are temporarily unavailable.

Configuration Reference

1Connection Settings

FieldTypeRequiredDefaultDescription
namestringYes-A unique name for this alert destination (e.g., "custom-webhook")
providerselectYeswebhookAlert provider - select "Webhook"
enabledbooleanNotrueEnable or disable alert delivery
urlstringYes-Webhook endpoint URL (HTTPS recommended)
methodselectNoPOSTHTTP method: POST, PUT, or PATCH

2Authentication Settings

FieldTypeRequiredDefaultDescription
auth_typeselectNononeAuthentication type: none, basic, bearer, api_key, hmac
auth_usernamestringNo-Username for basic authentication
auth_passwordpasswordNo-Password for basic authentication
auth_tokenpasswordNo-Bearer token for token authentication
api_key_headerstringNoX-API-KeyHeader name for API key authentication
api_key_valuepasswordNo-API key value
hmac_secretpasswordNo-Secret key for HMAC signature generation
hmac_headerstringNoX-SignatureHeader name for HMAC signature
hmac_algorithmselectNosha256HMAC algorithm: sha256, sha384, sha512

3Header Settings

FieldTypeRequiredDefaultDescription
content_typeselectNoapplication/jsonContent-Type header: application/json, application/x-www-form-urlencoded
custom_headersobjectNo-Additional HTTP headers as key-value pairs

4Payload Settings

FieldTypeRequiredDefaultDescription
payload_formatselectNodefaultPayload format: default (DB Audit format), custom (template)
payload_templatetextNo-Custom payload template using Handlebars syntax
include_raw_eventbooleanNofalseInclude the raw event data in the payload

5Alert Filtering

FieldTypeRequiredDefaultDescription
severity_filtermultiselectNoallAlert severities to send: critical, high, medium, low, info
alert_typesmultiselectNoallAlert types: policy_violation, anomaly_detection, threshold_breach, classification_alert
database_filterarrayNo-Limit to specific databases (empty = all databases)

6Delivery Settings

FieldTypeRequiredDefaultDescription
rate_limitnumberNo60Maximum alerts per minute (1-100)
timeout_secondsnumberNo30Request timeout in seconds (5-120)
retry_attemptsnumberNo3Number of retry attempts on failure
retry_delay_secondsnumberNo5Delay between retry attempts
success_codesarrayNo200,201,202,204HTTP status codes considered successful

Authentication Methods

None

No authentication. Only use for endpoints with network-level security.

No headers added

Basic Auth

HTTP Basic authentication with username and password.

Authorization: Basic base64(user:pass)

Bearer Token

Token-based authentication commonly used with OAuth.

Authorization: Bearer token

API Key

API key in a custom header (default: X-API-Key).

X-API-Key: your-api-key

HMAC Signature

Cryptographic signature for payload verification.

X-Signature: hmac-sha256(payload)

Setup Instructions

1

Create Your Webhook Endpoint

Set up an HTTP endpoint to receive alert data from DB Audit.

  • Use HTTPS for secure communication
  • Return 2xx status code on success
  • Respond within the configured timeout
  • Implement idempotency using alert_id
2

Test Your Endpoint

Verify your endpoint works with sample data.

                # Test your webhook endpoint with curl
curl -X POST https://your-endpoint.com/webhook \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "alert_id": "test_123",
    "type": "policy_violation",
    "severity": "high",
    "title": "Test Alert from DB Audit"
  }'
              
3

Configure in DB Audit

Add the webhook destination in the DB Audit dashboard.

  1. Navigate to Settings → Alert Destinations in DB Audit
  2. Click Add Destination
  3. Select Webhook as the provider
  4. Enter your endpoint URL
  5. Configure authentication if needed
  6. Customize the payload format (optional)
  7. Test the connection and save
4

Implement Signature Verification (Recommended)

Verify webhook signatures to ensure alerts are from DB Audit.

                // Verify HMAC signature in your webhook handler (Node.js example)
const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');

  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expectedSignature)
  );
}

// Express.js middleware
app.post('/webhook', express.raw({ type: 'application/json' }), (req, res) => {
  const signature = req.headers['x-signature'];
  const payload = req.body.toString();

  if (!verifyWebhook(payload, signature, process.env.WEBHOOK_SECRET)) {
    return res.status(401).json({ error: 'Invalid signature' });
  }

  const alert = JSON.parse(payload);
  // Process the alert...

  res.status(200).json({ received: true });
});
              

Payload Formats

Default Payload Format

The standard DB Audit alert format with full event details.

            {
  "alert_id": "alert_abc123xyz",
  "timestamp": "2024-01-15T10:30:45.123Z",
  "type": "policy_violation",
  "severity": "high",
  "title": "Bulk Data Access Detected",
  "description": "User accessed more than 10,000 rows in a single query",
  "source": {
    "database": "production-postgres",
    "db_type": "postgresql",
    "host": "db.example.com",
    "port": 5432
  },
  "actor": {
    "user": "app_user",
    "client_ip": "10.0.1.50",
    "application": "backend-api"
  },
  "event": {
    "query_type": "SELECT",
    "object": "public.customers",
    "rows_affected": 15000,
    "duration_ms": 2500
  },
  "policy": {
    "id": "policy_bulk_access",
    "name": "Bulk Data Access Policy"
  },
  "links": {
    "dashboard": "https://app.dbaudit.ai/alerts/alert_abc123xyz"
  }
}
          

Custom Template (Handlebars)

Use Handlebars syntax to create custom payload structures.

            // Custom payload template using Handlebars syntax
{
  "incident": {
    "title": "{{title}}",
    "description": "{{description}}",
    "severity": "{{#if (eq severity 'critical')}}P1{{else if (eq severity 'high')}}P2{{else}}P3{{/if}}",
    "source": "dbaudit",
    "tags": [
      "database:{{source.database}}",
      "user:{{actor.user}}",
      "type:{{type}}"
    ],
    "custom_fields": {
      "database_host": "{{source.host}}",
      "client_ip": "{{actor.client_ip}}",
      "rows_affected": {{event.rows_affected}},
      "policy_violated": "{{policy.name}}"
    }
  },
  "metadata": {
    "alert_id": "{{alert_id}}",
    "link": "{{links.dashboard}}"
  }
}
          

Testing Your Integration

Test via Dashboard

  1. Go to Settings → Alert Destinations
  2. Find your webhook destination
  3. Click the Test button
  4. Check your endpoint logs for the test payload
  5. Verify the response was successful

Test via API

            curl -X POST \
  https://api.dbaudit.ai/v1/alerts/test \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destination_id": "dest_abc123"}'
          

Troubleshooting

Connection timeout

The endpoint is not responding within the timeout period.

  • Increase the timeout_seconds setting
  • Check if the endpoint is behind a slow firewall or proxy
  • Verify the endpoint is publicly accessible from the internet

Authentication failed (401/403)

The authentication credentials are invalid or expired.

  • Verify the auth credentials are correct
  • Check if API keys or tokens have expired
  • Ensure the Authorization header format is correct

Invalid payload (400)

The endpoint rejected the payload format.

  • Check if custom template has syntax errors
  • Verify the Content-Type header matches expected format
  • Test the payload manually with curl

HMAC signature mismatch

The signature verification is failing on your endpoint.

  • Ensure you're using the raw request body for verification
  • Check the HMAC algorithm matches (sha256, sha384, sha512)
  • Verify the secret key is identical on both sides

SSL certificate error

The SSL certificate on the endpoint is invalid.

  • Ensure the certificate is valid and not expired
  • Verify the certificate chain is complete
  • Use a trusted certificate authority

Ready to Build Custom Integrations?

Start sending database security alerts to your custom endpoints in minutes.