Skip to main content
Every webhook event is also stored in event history. Read it to backfill, reconcile, or receive events without a public endpoint. Operations track work that finishes after the request returns, such as a campaign send. A project client sees its project. A team client sees team events and every project’s events.

List events

Filter with type, since, and until. To read one event with its body, ask for the payload:
The body is base64-encoded JSON. payloadAvailability tells you when a body is not available, for example after it expired. See Event history.

Poll for new events

listIndexed returns events in the order Polymorfa stored them, not the order they happened. Use it for polling: an event that is stored late, such as a message received after a reconnect, still appears after your saved offset. Start from a baseline, then poll from the saved offset:
While hasMore is true, continue from nextOffset. When the page is exhausted, save highWatermark and pass it on your next poll. Offsets are decimal strings. Keep them as strings.

Stream events in real time

Event streams are a beta. A team owner or admin enrolls the team in the Console. Without enrollment, the stream throws PolymorfaAuthorizationError with code feature_unavailable. See Event streams.
stream() reconnects after a dropped connection and resumes from the last event it delivered. Each item has:
  • event: the event record, with the same fields as events.retrieve.
  • webhook: the webhook body, or null when the body was not kept.
  • cursor: the position after this event.
To resume after a restart, pass your saved cursor as since. Pass onGap to learn when events expired before you resumed. Aborting the signal or leaving the loop closes the stream. A team client must pass projectId. Run streams on your server only. Client tokens cannot open them.

Replay an event

Send a stored event to one webhook endpoint again:
Only the endpoint you name receives the event. An event can be replayed until its replayableUntil time.

Wait for an operation

Methods that start background work return an operation ID. Wait for it to finish:
wait returns when the operation succeeds, fails, or is cancelled, or when maxWaitMs ends (5 minutes by default). It returns the latest state either way, so always check status.

Find and cancel operations

get(id) reads one operation. Pass { wait: 30 } to hold the request open for up to 30 seconds until the operation changes. listTransitions(id) lists its state changes. Cancelling works only while capabilities.cancellable is true. See Operations.