Provenance
Notifications

Subscriptions

Subscribe to events and get notified when interactions happen.

Subscriptions connect events to notification adapters. When an interaction matches a subscription's resource type + action combination, a notification is automatically queued.

Creating a subscription

POST /api/subscriptions
{
  "actionId": "uuid",
  "resourceTypeId": "uuid",
  "subscriberId": "uuid",
  "originId": "uuid",
  "config": {
    "adapter": "adapter:email",
    "personalizations": [{
      "to": [{
        "email": "{{interaction.email}}",
        "name": "{{interaction.name}}"
      }],
      "dynamic_template_data": {
        "userName": "{{interaction.name}}"
      }
    }],
    "from": { "email": "noreply@example.com" },
    "template_id": "d-template-id"
  }
}

Fields

FieldRequiredDescription
actionIdYesAction UUID to match
resourceTypeIdYesResource type UUID to match
subscriberIdYesSubscriber to notify
originIdNoFilter by origin — null matches all origins
configNoAdapter-specific configuration with template variables

How it works

  1. An interaction is created via POST /api/interactions
  2. A database trigger finds all matching subscriptions (by resource type + action)
  3. For each match, a notification is added to the queue
  4. The queue processor picks it up and calls the configured adapter
  5. The adapter delivers the notification (email, Slack, webhook, etc.)
  6. The result is logged in the audit trail

Template variables

Use {{interaction.fieldName}} in your subscription config to inject values from the interaction's metadata:

{
  "to": "{{interaction.email}}",
  "subject": "Order {{interaction.orderId}} confirmed",
  "body": "Hi {{interaction.name}}, your order is ready."
}

Beyond interaction fields, you can reference global config, adapter settings, secrets, and built-in functions. See the full Template Engine reference for all available namespaces and functions.

API reference

MethodEndpointDescription
GET/api/subscriptionsList all
GET/api/subscriptions/:idGet by ID
POST/api/subscriptionsCreate
PUT/api/subscriptions/:idUpdate
DELETE/api/subscriptions/:idDelete
POST/api/subscriptions/:id/pausePause
POST/api/subscriptions/:id/resumeResume