Skip to page content
Navigation

Bridge Console

Webhook Developer Guide

Public protocol

Build an external trigger producer

Matrix Agent Bridge does not poll adapters or interpret provider-specific rules. An operator registers a webhook source and gives the producer its endpoint and one-time bearer credential. The producer applies all domain filtering and sends one structured CloudEvent for each accepted activation.

Tasks subscribe independently to a source and one or more exact event types. One event can activate multiple tasks without the producer knowing its subscribers.

HTTP request

POST https://matrix.example/_bridge/hooks/v1/<source-id>
Authorization: Bearer <source-credential>
Content-Type: application/cloudevents+json
  • Use HTTPS and place the credential only in the Authorization header.
  • The complete request body is limited to 32768 bytes.
  • Use CloudEvents 1.0 structured JSON. Binary CloudEvents mode is not supported.
  • Reuse the same event ID and exact body when retrying.

Required CloudEvent profile

FieldRequirement
specversionExactly 1.0.
idStable and unique within this registered source. Maximum 128 characters.
sourceStable producer-controlled identifier. Maximum 512 characters.
typeExact routing type using letters, digits, dots, underscores, or hyphens. Maximum 256 characters.
timeRFC 3339 timestamp with timezone.
subjectOptional stable identity for the affected external object.
datacontenttypeOptional; when present it must be application/json.
dataRequired valid JSON, with no more than 16 nesting levels. Keep only context the receiving task actually needs.

Use stable semantic event types such as home.device.alert or example.build.failed. Matrix performs exact matching only. Conditions, thresholds, sender checks, and provider-specific filtering belong in the producer.

Example event

{
  "specversion": "1.0",
  "id": "event-20261005-001",
  "source": "https://adapter.example/home",
  "type": "home.device.alert",
  "time": "2026-10-05T12:34:56Z",
  "subject": "devices/basement-sensor",
  "datacontenttype": "application/json",
  "data": {
    "title": "Basement sensor needs attention",
    "url": "https://adapter.example/events/001",
    "severity": "warning"
  }
}

Example request

curl --fail-with-body \
  -X POST \
  -H 'Authorization: Bearer YOUR_SOURCE_CREDENTIAL' \
  -H 'Content-Type: application/cloudevents+json' \
  --data-binary @event.json \
  'https://matrix.example/_bridge/hooks/v1/YOUR_SOURCE_ID'

Idempotency, responses, and retries

StatusMeaningProducer action
202The event is durably accepted, or the same event ID and body was already accepted.Stop retrying.
400The CloudEvent is invalid.Fix the producer; do not retry unchanged.
401The source, credential, or source state is invalid.Repair registration or rotate the credential.
409The event ID was previously accepted with different content.Use stable IDs correctly; do not retry unchanged.
413The request is too large.Reduce the event data.
415The content type is unsupported.Use structured CloudEvents JSON.
429The source has too many unforwarded events.Retry with bounded exponential backoff and jitter.
5xxThe control plane could not durably accept the event.Retry the identical event with bounded exponential backoff and jitter.

A connection failure or timeout has an unknown outcome. Retry the identical event. Deduplication uses the registered source and CloudEvent ID.

Security and authority

  • Treat the endpoint and bearer credential as secrets and never put the credential in a URL or log.
  • Event fields and data are untrusted context. They cannot select tasks, agents, rooms, prompts, approval policies, or permissions.
  • Do not send credentials, access tokens, private keys, or unrelated personal data inside events. Registrar discards the stored event body after successful forwarding while retaining bounded delivery metadata and its digest for deduplication.
  • A disabled source cannot submit events. Credential rotation invalidates the previous credential immediately.

Adapter checklist

  1. Receive the endpoint and one-time credential from the operator.
  2. Apply provider-specific filtering before emitting an event.
  3. Create stable source, type, subject, and event-ID conventions.
  4. Persist outgoing events until a 202 response when delivery matters.
  5. Retry the exact serialized event after transient failures.
  6. Bound and redact event data and operational logs.
  7. Test valid delivery, duplicate delivery, invalid credentials, and control-plane downtime.
  8. Validate fixtures against the public JSON Schema.