Subscriptions
A subscription is a filter and a target: what to do with each event that matches. Its target is a webhook endpoint, which gets a delivery for each match, or a topic, which makes notifications in principals’ inboxes and pushes to their phones.
Targets
- A webhook:
{ "kind": "webhook", "endpointId": "end_…" }. Each match makes one delivery to the endpoint. - A notification:
{ "kind": "notification", "topic": "…", "recipients": …, "template": … }. Each match makes one notification per distinct recipient selected byids, by data paths infromPaths, or byfollowers: truefor the topic’s followers. The template’stitle,body, andurltake the event’s values in{{type}},{{subject}},{{source}},{{id}},{{time}},{{<extension>}}, and{{data.<path>}}, and each notification keeps the text it was made with. The template’s optionalpushholds a shortertitleandbodyfor the lock screen, which Push explains.
Matching
A published event is matched as it is accepted. Each active subscription whose filter it meets gets a match that records the subscription’s version. Replay is how a webhook subscription can act on older or imported events.
A test says whether a filter, or a subscription’s own, matches an event, given inline or by its sequence, with the outcome of each clause, and writes nothing.
Versions
Changing a subscription’s filter or target makes a new version, used for events accepted from then on. Every version is kept with when it was in force, and every match names the version it used, so you can tell why an event was sent where it went. Changing its name or description makes no version.
Pausing and deleting
A paused subscription matches no new publishes. Resuming it applies to events accepted from then on. For a webhook subscription, replay the paused window to send the missed events.
A deleted subscription stops matching new publishes and leaves its existing matches and deliveries in place. An endpoint or topic that a non-deleted subscription targets can only be deleted once you delete or retarget the subscription.
Limits
- A subscription’s
nameis at most 200 characters. - A notification target names at most 100 recipients in
ids, and at most 10 data paths infromPaths.
Where to act on it
- Receive webhooks and Notify principals in their inbox create one of each.
- Test a subscription, Update a subscription, List subscription versions, and List subscription matches.
- The subscriptions reference.