Integrations

Connect your zMesh project to external services with outgoing webhooks and third-party provider integrations.

🔗

Event-Driven Architecture

Subscribe to system events like auth.signup, db.insert, or storage.upload and push them to any HTTP endpoint with signing secrets for verification.

Outgoing Webhooks

Register HTTP endpoints to receive real-time notifications when events happen in your project. Each webhook includes an HMAC signature for verification.

Register Webhook

POST /projects/{project_id}/integrations/webhooks

{
  "url": "https://your-app.com/webhooks/zmesh",
  "events": ["auth.signup", "db.insert", "storage.upload"],
  "secret": "whsec_your_signing_secret"
}

// Response
{
  "id": "uuid",
  "url": "https://your-app.com/webhooks/zmesh",
  "events": ["auth.signup", "db.insert", "storage.upload"],
  "active": true
}

List Webhooks

GET /projects/{project_id}/integrations/webhooks

Authorization: Bearer <token>

Update & Delete

PUT /projects/{project_id}/integrations/webhooks/{webhook_id}

{ "events": ["auth.signup"], "active": false }

DELETE /projects/{project_id}/integrations/webhooks/{webhook_id}

Delivery Logs

GET /projects/{project_id}/integrations/webhooks/{webhook_id}/deliveries

// Returns delivery history with status codes and response times

Test Webhook

POST /projects/{project_id}/integrations/webhooks/{webhook_id}/test

// Sends a test.ping event to verify your endpoint

Available Events

GET /projects/{project_id}/integrations/events

// Returns all subscribable system events:
// auth.signup, auth.login, auth.password_reset
// db.insert, db.update, db.delete
// storage.upload, storage.delete
// functions.invoked, functions.error
// user.created, user.updated, user.deleted

Provider Integrations

Connect third-party services to your project for notifications, analytics, and more.

GET /projects/{project_id}/integrations/providers

// Lists available providers and their configuration status
// Slack, Discord, Razorpay, etc.

PUT /projects/{project_id}/integrations/providers/{provider}

// Configure or update provider settings

POST /projects/{project_id}/integrations/providers/{provider}/toggle

// Enable or disable without removing configuration

Verifying Webhook Signatures

// Node.js example
const crypto = require('crypto');

function verifyWebhook(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}