---
title: "Webhooks and change feed · Workwae"
description: "Signed webhooks with filters, retries, a delivery log and replay, plus an ordered change feed. Every mail, calendar and contact change, pushed or pulled."
url: https://workwae.com/features/webhooks
---

1. [Features](https://workwae.com/features/)
2. Webhooks and [change feed](https://workwae.com/glossary#change-feed)

Webhooks and change feed

# Every change, signed, ordered and replayable.

One feed records every change to mailboxes, calendars and contact books; pull it with a cursor, or receive each event as a [signed webhook](https://workwae.com/glossary#signed-webhook).

[Request early access](https://workwae.com/early-access/) [Read the webhooks guide](https://docs.workwae.com/guides/webhooks)

hooks/workwae.tshooks/workwae.py

```ts
import { parseWebhook } from "@workwae/sdk";

export async function POST(request: Request) {
  // Verify the raw body, before parsing it
  const body = await request.text();
  let event;
  try {
    event = await parseWebhook(secret, request.headers, body);
  } catch {
    return new Response("Invalid webhook", { status: 400 });
  }

  // Retries and replays reuse the id: deduplicate on it
  const isNew = await markSeen(event.id);

  if (isNew && event.known && event.type === "message.created") {
    await queue.add(event.id, event.data.message.subject);
  }
  return new Response(null, { status: 204 });
}
```

```python
from collections.abc import Mapping

from workwae import UnknownEvent, WebhookVerificationError, parse_webhook

def receive(headers: Mapping[str, str], body: bytes) -> int:
    # Verify the raw body, before parsing it
    try:
        event = parse_webhook(secret, headers, body)
    except WebhookVerificationError:
        return 400

    # Retries and replays reuse the id: deduplicate on it
    is_new = mark_seen(event.id)

    if is_new and not isinstance(event, UnknownEvent) and event.type == "message.created":
        queue.add(event.id, event.data.message.subject)
    return 204
```

What you get

## Delivery you can verify, filter and recover.

Webhooks and the feed carry the same events with the same ids: `id`, `type`, `accountId`, `createdAt` and `data`.

### Standard Webhooks signatures

HMAC-SHA256 signatures in Standard Webhooks headers, checked by any Standard Webhooks library or the TypeScript and Python SDKs.

### Secrets you can rotate

Each endpoint's `whsec_` secret is shown once and sealed with keys held in Vault; after a rotation the old one keeps signing too for a grace period (24 hours by default, up to 7 days, or none).

### Filters per endpoint

Event types, accounts, and for messages mailbox or role, sender, recipient, subject, attachments and direction, up to 100 values per filter.

### Retries with backoff

Failed deliveries are retried with doubling delays, up to an hour apart, for up to 3 days.

### Throttling honored

A `429`, or a `503` with `Retry-After`, delays only that delivery.

### Failure tracking

Endpoints report `failingSince` and `lastSuccessAt`, and are disabled after 72 hours without a success.

### A delivery log

The last 500 attempts per endpoint, for up to 7 days, with status, latency, error and the first kilobyte of your answer.

### Replay

Queue one event whatever the filters, or up to 1,000 per call from a time range, with the same id and body and a fresh signature.

### Test events and a tester

Signed test events of any type skip filters, and the console's tester URL records each delivery and checks its signature.

Build it

## Receive only the mail that matters

Filters run before anything is sent, so your endpoint never discards events it did not want.

- Every criterion you set must match, and any one value within a criterion is enough.
- Message criteria narrow `message.*` and `send.*` events; other events pass, and an event that cannot answer a criterion does not match it.
- Addresses ignore case, `@example.com` matches the whole domain, and `to` covers to, cc and a bounce's failed recipients.
- `outbound` means mail in Sent or from the account's own addresses, and every `send.*`, `message.bounced`, `message.opened` and `message.clicked` event.
- `message.deleted` carries the message and its mailboxes as last indexed, so it matches like the message did.

endpoint.tsendpoint.py

```ts
// New inbound mail to support@, from one account
const { endpoint, secret } = await workwae.webhooks.create({
  url: "https://helpdesk.example.com/hooks/workwae",
  description: "Support inbox",
  filters: {
    eventTypes: ["message.created"],
    accountIds: [supportAccount.id],
    message: {
      mailboxRoles: ["inbox"],
      direction: "inbound",
      to: ["support@example.com", "@help.example.com"],
    },
  },
});
// Store the secret now: it is not shown again
await vault.put("workwae-webhook", secret);
// Try the receiver before real traffic exists
await workwae.webhooks.test({
  endpointId: endpoint.id,
  eventType: "message.created",
});

// Rotate: deliveries carry signatures by both secrets
// for graceSeconds (default 24 hours, at most 7 days);
// graceSeconds: 0 drops the old secret at once
const { secret: next } = await workwae.webhooks.rotateSecret({
  endpointId: endpoint.id,
  graceSeconds: 3600,
});
```

```python
# New inbound mail to support@, from one account
created = workwae.webhooks.create(
    url="https://helpdesk.example.com/hooks/workwae",
    description="Support inbox",
    filters={
        "event_types": ["message.created"],
        "account_ids": [support_account.id],
        "message": {
            "mailbox_roles": ["inbox"],
            "direction": "inbound",
            "to": ["support@example.com", "@help.example.com"],
        },
    },
)
# Store the secret now: it is not shown again
vault.put("workwae-webhook", created.secret)

# Try the receiver before real traffic exists
workwae.webhooks.test(
    endpoint_id=created.endpoint.id,
    event_type="message.created",
)

# Rotate: deliveries carry signatures by both secrets
# for grace_seconds (default 24 hours, at most 7 days);
# grace_seconds=0 drops the old secret at once
rotated = workwae.webhooks.rotate_secret(
    endpoint_id=created.endpoint.id,
    grace_seconds=3600,
)
```

Build it

## Recover from a receiver outage

When your endpoint goes down, Workwae keeps the events until you fix the receiver and send what it missed.

- `failingSince``failing_since` shows a streak long before the 72-hour limit.
- Each logged attempt has its status, error and the start of your response, and says whether it came from a replay or a test.
- A range replay skips events already queued for the endpoint and counts them in `alreadyQueued``already_queued`.
- A replay carries the original id, so handling keyed on `webhook-id` stays safe to run.

recover.tsrecover.py

```ts
// Which endpoints are failing, or were disabled?
const { items } = await workwae.webhooks.list();
const unwell = items.filter((e) => !e.isEnabled || e.failingSince);

// What did the receiver answer?
const log = await workwae.webhooks.attempts({
  endpointId,
  result: "failed",
  since: new Date("2026-11-02T00:00:00Z"),
});
for (const a of log.items) {
  console.log(a.statusCode, a.error, a.responseExcerpt);
}

// Fixed: enable it again and deliver the missed day
await workwae.webhooks.update({ endpointId, isEnabled: true });
const { queued, alreadyQueued } = await workwae.webhooks.replay({
  endpointId,
  since: new Date("2026-11-02T00:00:00Z"),
  until: new Date("2026-11-03T00:00:00Z"),
});

// Or just one event, whatever the filters
await workwae.webhooks.replayEvent({
  endpointId,
  eventId: "1001",
});
```

```python
from datetime import datetime, timezone

# Which endpoints are failing, or were disabled?
endpoints = workwae.webhooks.list()
unwell = [e for e in endpoints.items if not e.is_enabled or e.failing_since]

# What did the receiver answer?
log = workwae.webhooks.attempts(
    endpoint_id=endpoint_id,
    result="failed",
    since=datetime(2026, 11, 2, tzinfo=timezone.utc),
)
for a in log.items:
    print(a.status_code, a.error, a.response_excerpt)

# Fixed: enable it again and deliver the missed day
workwae.webhooks.update(endpoint_id=endpoint_id, is_enabled=True)
replay = workwae.webhooks.replay(
    endpoint_id=endpoint_id,
    since=datetime(2026, 11, 2, tzinfo=timezone.utc),
    until=datetime(2026, 11, 3, tzinfo=timezone.utc),
)
print(replay.queued, replay.already_queued)

# Or just one event, whatever the filters
workwae.webhooks.replay_event(endpoint_id=endpoint_id, event_id="1001")
```

Build it

## Pull the feed instead

With no public endpoint, in a batch job, or when changes must apply in commit order, read the change feed with a saved cursor.

- `GET /v1/changes` pages by transaction, so an event committed after a later one is never skipped.
- A page is `{ items, nextCursor }`; the cursor is never null, and an empty page means caught up.
- The SDKs' `changes` helper moves past a page only once every event in it was consumed, so saving the cursor after processing gives at-least-once handling.
- `types` limits the feed to the events you handle; test events are never in it.
- A type newer than your SDK arrives with `known: false``UnknownEvent` and its data unchecked, so it never breaks a receiver.

feed.tsfeed.py

```ts
import { changes } from "@workwae/sdk";

// Resume where you left off, with only the types you handle
const feed = changes(workwae.changes.list, {
  cursor: await db.getCursor(),
  types: [
    "calendar_event.created",
    "calendar_event.updated",
    "calendar_event.deleted",
  ],
});

// Stops at an empty page: caught up
for await (const event of feed) {
  await apply(event);
}

// Saved after processing: a crash mid-page replays that page
await db.saveCursor(feed.cursor);
```

```python
from workwae import changes

# Resume where you left off, with only the types you handle
feed = changes(
    workwae.changes.list,
    cursor=db.get_cursor(),
    types=[
        "calendar_event.created",
        "calendar_event.updated",
        "calendar_event.deleted",
    ],
)

# Stops at an empty page: caught up
for event in feed:
    apply(event)

# Saved after processing: a crash mid-page replays that page
db.save_cursor(feed.cursor)
```

Reference

## Delivery rules, event types and questions.

**What happens to each delivery**

Each delivery is a JSON POST signed with HMAC-SHA256 over the id, timestamp and body, in the `webhook-id`, `webhook-timestamp` and `webhook-signature` headers; the SDKs' `parseWebhook``parse_webhook` allows five minutes of clock tolerance. Answer any 2xx within 10 seconds and do the work in a queue of your own.

| Your endpoint | What Workwae does |
| --- | --- |
| Answers 2xx within 10 seconds | Success, logged with its status and latency. |
| Answers another status or a redirect, times out or refuses the connection | A failure, retried after 5 seconds, then doubling up to one hour with 20 percent jitter; redirects are never followed. |
| Answers `429`, or `503` with `Retry-After` | That delivery waits the `Retry-After` (seconds or an HTTP date, kept between 5 seconds and an hour), or 30 seconds without one, doubling if throttled again; it is not an attempt and does not count toward the 72 hours. |
| Succeeds again after failing | Deliveries waiting out a backoff are sent right away; throttled ones wait out their `Retry-After`. |
| Cannot be reached because Workwae's network or DNS is down | The outage is ours: retried after 30 seconds without counting against your endpoint, and still logged. |
| Still failing 3 days after an event was queued | The delivery is given up and marked failed; failed deliveries are deleted after 30 days. |
| Fails for 72 hours without a single success | Disabled: `isEnabled` becomes false, `disabledReason` says why, no new events arrive and queued deliveries wait. Re-enable it, then replay what it missed. |

**Delivery safeguards**

- Endpoint URLs must be HTTPS, or the request is refused with `https_required`.
- Deliveries to private, loopback and link-local addresses are refused, and the connection is pinned to the checked addresses while TLS verifies the hostname, so DNS rebinding cannot redirect one.
- Requests in flight per endpoint are capped and workspaces share capacity evenly, so a slow endpoint never holds up others.
- An endpoint receives only events created after it, oldest first, but arrival order is not guaranteed; read the feed when order matters.
- Every request carries `user-agent: workwae-webhooks/1`.

**Every event type**

Each type's `data` is typed in the SDKs, and the [events guide](https://docs.workwae.com/guides/events) has a sample body for each; events that concern no account carry a null `accountId`.

| Event | When it is sent |
| --- | --- |
| Accounts |  |
| `account.connected` | An account was connected, or signed in again (`reauthorized: true`). |
| `account.updated` | Its status, externalRef, settings or connection changed, listed in `fields`. |
| `account.reauth_required` | The provider refused the grant, with the reason; the account must sign in again. |
| `account.initialized` | The first mail sync finished; nothing before it is announced. |
| `account.deleted` | An account was deleted; its data is purged after the retention period, or at once. |
| `account.purged` | A deleted account's data is gone; names no account, since it outlives it. |
| Mailboxes |  |
| `mailbox.created`, `mailbox.deleted` | A folder or label appeared or went away. |
| `mailbox.updated` | Renamed, moved or given another role; counts change silently. |
| Messages |  |
| `message.created` | Indexed: received, sent, drafted, or moved in from outside the sync window. |
| `message.updated` | Read, flagged, moved, or linked to the outbox entry it copies. |
| `message.deleted` | Removed; carries it and its mailboxes as last indexed. |
| `message.bounced` | A delivery status notification reported failed recipients, with the outbox id for your sends. |
| `message.classified` | AI classified a reply to one of your sends, when reply classification is on. |
| `message.opened`, `message.clicked` | A send's open pixel loaded or tracked link followed, by a person or a machine. |
| Sends and suppressions |  |
| `send.sent` | The provider accepted a queued send. |
| `send.retrying` | An attempt failed; queued again for `nextAttemptAt`. |
| `send.failed` | Failed for good: refused, or out of attempts. |
| `send.rescheduled` | A new send time before the first attempt. |
| `suppression.created` | An address was suppressed: an unsubscribe, a permanent bounce, or a detected opt-out. |
| Calendars |  |
| `calendar.initialized` | The first calendar sync finished; nothing before it is announced. |
| `calendar.created`, `calendar.updated`, `calendar.deleted` | A calendar appeared, changed or went away. |
| `calendar_event.created`, `calendar_event.updated`, `calendar_event.deleted` | A single event, series or exception appeared, changed or went away; a series change is one update, and unmodified occurrences are never announced. |
| `booking.created`, `booking.cancelled` | A [scheduling link](https://workwae.com/glossary#scheduling-link) took a booking, or one was cancelled; the calendar event comes as its own events. [How bookings work](https://workwae.com/features/bookings). |
| Contacts |  |
| `contacts.initialized` | The first contacts sync finished; nothing before it is announced. |
| `contact.created`, `contact.updated`, `contact.deleted` | A contact appeared, changed or went away. |
| Meetings, exports and tests |  |
| `meeting_connection.connected` | An account connected or reconnected its own Zoom or Webex grant. |
| `meeting_connection.reauth_required` | Zoom or Webex refused the meeting grant; mail and calendar sync go on. |
| `export.completed`, `export.failed` | A data export finished, downloadable until it expires, or failed. |
| `webhook.test` | Sent by the test action to the endpoint it names; never in the feed. |

**Can the same event arrive twice?**

Yes, retries and replays deliver the same event id again, in the `webhook-id` header and the body. Make your handling idempotent on that id.

**Will I get an event for every message when an account connects?**

No, a new account's first sync is quiet and ends with one `account.initialized`, plus `calendar.initialized` or `contacts.initialized` when those are on. Read existing mail through the API; every later change is announced.

**How far back can I replay?**

As far as your tenant's `eventRetentionDays`, set between 7 and 30 days, which is also how long the feed keeps events. A range replay queues at most 1,000 events per call, so split larger ranges.

Early access

## Stop polling every provider yourself.

Workwae is in early access; tell us what you are building, and read the webhooks guide in the meantime.

[Request early access](https://workwae.com/early-access/) [Read the webhooks guide](https://docs.workwae.com/guides/webhooks)
