Webhook, Email & Notification API

Webhook subscriptions, email sending/bulk, message templates, and real-time notifications with SignalR.

The Webhook, Email & Notification API provides event-driven integrations, transactional email delivery, template management, and real-time in-app notifications. Webhooks use HMAC signature verification for security.

Webhooks

Webhooks allow external systems to subscribe to SCRIPE events. When an event occurs (admin created, user registered, etc.), SCRIPE sends an HTTP POST to the subscriber URL with a signed payload. Failed deliveries are retried up to 3 times with exponential backoff.

MethodEndpointDescriptionAuth
GET/api/v1/webhooksList all webhook subscriptions for the current tenant.🔒 Required
POST/api/v1/webhooksCreate a new webhook subscription with URL, events, and HMAC secret.🔒 Required
PUT/api/v1/webhooks/{id}Update a webhook's URL, events, or active status.🔒 Required
DELETE/api/v1/webhooks/{id}Delete a webhook subscription.🔒 Required
POST/api/v1/webhooks/{id}/testSend a test event to the webhook URL to verify connectivity.🔒 Required
POST /webhooks — RequestJSON
{
  "url": "https://api.example.com/webhooks/scripe",
  "secret": "whsec_a1b2c3d4e5f6...",
  "events": [
    "admin.created",
    "admin.updated",
    "admin.deleted",
    "user.registered",
    "tenant.settings_changed"
  ],
  "isActive": true,
  "description": "Sync admin changes to external system"
}
Event TypeTriggerData Fields
admin.createdNew admin registeredadminId, email, role, tenantId
admin.updatedAdmin profile changedadminId, changedFields
admin.deletedAdmin soft-deletedadminId, deletedBy
admin.blockedAdmin account blockedadminId, blockedBy, reason
user.registeredNew user registrationuserId, email, tenantId
user.verifiedEmail/phone verifieduserId, verificationType
tenant.createdNew tenant createdtenantId, name, parentId
tenant.settings_changedTenant settings updatedtenantId, changedSettings
role.permissions_changedRole permissions modifiedroleId, addedPerms, removedPerms
Failed Login AttemptFailed login attemptemail, ip, attempts
Account Security LockoutAccount locked outuserId, lockoutEnd

Email System

The email system supports individual and bulk email sending with template variable interpolation. Emails are queued via background services and processed asynchronously. The system supports scheduling, cancellation, and resending of failed emails.

MethodEndpointDescriptionAuth
GET/api/v1/emailsList sent/queued/failed emails with pagination and status filters.🔒 Required
POST/api/v1/emails/sendSend a single email using a template with variable substitution.🔒 Required
POST/api/v1/emails/send-bulkSend bulk emails to multiple recipients or a filtered group.🔒 Required
DELETE/api/v1/emails/{id}/cancelCancel a queued (not yet sent) email.🔒 Required
POST/api/v1/emails/{id}/resendResend a failed email.🔒 Required
GET/api/v1/emails/statsGet email statistics (sent, failed, queued, bounce rate).🔒 Required
GET/api/v1/emails/search-recipientsSearch for valid email recipients (admins/users) by name or email.🔒 Required
POST /emails/send — RequestJSON
{
  "to": "user@example.com",
  "subject": "Welcome to SCRIPE",
  "templateId": "template-uuid",
  "variables": {
    "name": "Alice Johnson",
    "companyName": "Acme Corp",
    "activationUrl": "https://app.scripe.dev/activate?token=..."
  },
  "priority": "high",
  "scheduledAt": null
}

Message Templates

Message templates use the Scriban engine (Liquid-compatible) for variable interpolation. Templates support HTML and plain-text bodies, with preview and render endpoints for testing before sending.

MethodEndpointDescriptionAuth
GET/api/v1/message-templatesList all message templates with category and status filters.🔒 Required
GET/api/v1/message-templates/{id}Get a single template with full body content and variable definitions.🔒 Required
POST/api/v1/message-templatesCreate a new message template with HTML/text body and variables.🔒 Required
PUT/api/v1/message-templates/{id}Update a template's content, subject, or variables.🔒 Required
DELETE/api/v1/message-templates/{id}Delete a message template.🔒 Required
POST/api/v1/message-templates/{id}/previewPreview a template with sample data (returns rendered HTML).🔒 Required
POST/api/v1/message-templates/{id}/renderRender a template with provided variables (returns final HTML + text).🔒 Required
Message Template ExampleJSON
{
  "id": "template-uuid",
  "name": "welcome-admin",
  "subject": "Welcome to {{companyName}}!",
  "bodyHtml": "<h1>Hello {{name}}</h1><p>Welcome to {{companyName}}...</p>",
  "bodyText": "Hello {{name}}, Welcome to {{companyName}}...",
  "engine": "scriban",
  "variables": ["name", "companyName", "activationUrl"],
  "category": "onboarding",
  "isActive": true
}
// Template engine: Scriban (Liquid-compatible)
// Variables use {{variableName}} syntax

Notifications

MethodEndpointDescriptionAuth
GET/api/v1/notificationsList in-app notifications for the current user with pagination.🔒 Required
GET/api/v1/notifications/unread-countGet the count of unread notifications.🔒 Required
PUT/api/v1/notifications/{id}/readMark a single notification as read.🔒 Required
PUT/api/v1/notifications/read-allMark all notifications as read.🔒 Required
DELETE/api/v1/notifications/{id}Delete a notification.🔒 Required
GET/api/v1/notifications/search-targetsSearch for notification targets (users/admins) by name or email.🔒 Required