> ## Documentation Index
> Fetch the complete documentation index at: https://developer.lofty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Subscribe to real-time event notifications from Lofty via HTTP callbacks.

Webhooks deliver real-time HTTP POST notifications to your endpoint when data changes in a Lofty account. Instead of polling the API, register an HTTPS callback URL and Lofty pushes a JSON payload on each subscribed event.

## Subscribe

```bash theme={null}
POST https://api.lofty.com/v1.0/webhook
```

```json theme={null}
{
  "listId": 2,
  "callbackUrl": "https://your-app.example.com/webhooks/lofty",
  "limit": 100
}
```

| Field | Type | Required | Description |
| - | - | - | - |
| `listId` | integer | Yes | Event type (1–13, see table below) |
| `callbackUrl` | string | Yes | Public HTTP(S) endpoint to receive payloads |
| `limit` | integer | No | Max events per batch (default 100, max 5000) |
| `authHeader` | object | No | A header of your choice that Lofty adds to every delivery. See [Custom authentication header](#custom-authentication-header) |

The response contains the subscription and its signing secret:

```json theme={null}
{
  "subscribeId": 1234,
  "teamId": 123456,
  "listId": 2,
  "callbackUrl": "https://your-app.example.com/webhooks/lofty",
  "limit": 100,
  "permissionMode": 0,
  "secret": "whsec_bG9mdHktc2FtcGxlLXNpZ25pbmctc2VjcmV0LTAwMDE="
}
```

If the `callbackUrl` carries a query string (for example `?token=...`) or uses `http`, the response also has a `warnings` array and the subscription is still created:

```json theme={null}
"warnings": [
  { "code": "CALLBACK_URL_HAS_QUERY", "message": "The callbackUrl carries a query string. Do not put a secret or token in the URL ..." }
]
```

A token in the URL ends up in logs and proxies, and it proves neither the sender nor the body. Use the signature instead: see [Verify webhook signatures](#verify-webhook-signatures). The `warnings` key is absent when there is nothing to report.

> [!WARNING]
>
> **Store the `secret` now.** It is shown only in this response and is never returned again — not by the list endpoint, not by a later call. If you lose it, [rotate it](#rotate-the-secret). Use it to [verify that each delivery comes from Lofty](#verify-webhook-signatures).

> [!WARNING]
>
> Use a publicly reachable **`https`** `callbackUrl`. An `http` URL is still accepted for now, and the create response then carries a `CALLBACK_URL_NOT_HTTPS` warning; we will announce in the [changelog](https://developer.lofty.com/changelog/2026.md), ahead of time, before `http` stops being accepted for new subscriptions. URLs that carry credentials or point to internal or private addresses are rejected with `WEBHOOK_CALLBACK_URL_INVALID`. Subscriptions created earlier keep working unchanged.

## Manage subscriptions

| Method | Endpoint | Description |
| - | - | - |
| `POST` | `/v1.0/webhook` | Create a subscription (returns its signing secret once) |
| `GET` | `/v1.0/webhooks` | List active subscriptions |
| `POST` | `/v1.0/webhook/{subscribeId}/secret/rotate` | Issue a new signing secret |
| `DELETE` | `/v1.0/webhook/{subscribeId}` | Delete a subscription |

## Verify webhook signatures

Deliveries of a signed subscription carry a signature, so your endpoint can check that the request really comes from Lofty and that nobody changed the body on the way. The signature follows the [Standard Webhooks](https://github.com/standard-webhooks/standard-webhooks/blob/main/spec/standard-webhooks.md) v1 scheme (HMAC-SHA256), so existing open-source verification libraries work with Lofty webhooks too.

Do not rely on a secret in the callback URL for this. A URL ends up in server logs, proxies and browser history, and it does not prove that the body is unchanged.

### Headers on signed deliveries

Every new subscription is signed. A subscription created earlier is signed once you [rotate its secret](#rotate-the-secret); until then it receives no signature headers.

| Header | Value |
| - | - |
| `webhook-id` | The message id. Same value as `Lofty-Webhook-Id`, stable across retries |
| `webhook-timestamp` | When this attempt was sent, in Unix seconds. **Set again on every retry** |
| `webhook-signature` | `v1,` followed by the base64 HMAC-SHA256 signature. During a [secret rotation](#rotate-the-secret) it holds one signature per secret, separated by spaces |

The `Lofty-Webhook-Id` header stays as it was.

### How to verify

1. Read the **raw request body** as bytes, before any JSON parsing. A parsed and re-serialized body no longer matches the signature.
2. Build the signed content: `webhook-id` + `.` + `webhook-timestamp` + `.` + the raw body.
3. Take your secret without the `whsec_` prefix, base64-decode it, and compute HMAC-SHA256 of the signed content with that key.
4. Base64-encode the result and compare it with each `v1` signature in `webhook-signature`. Use a **constant-time** comparison. One match is enough.
5. Reject the request if `webhook-timestamp` is more than **5 minutes** away from your clock. This stops someone from replaying an old, valid request.

Return `401` for a request that fails verification and do not process it.

> [!WARNING]
>
> Lofty does not retry a `4xx` response (other than `429` and `410`) — it discards the event; see [Response handling](#response-handling). A receiver that rejects genuine deliveries because of a wrong or outdated secret therefore **loses events**. Check your verification against a real delivery, or log failures without rejecting, before you start returning `401`.

> [!NOTE]
>
> Ping probes are signed in the same way, with a `webhook-id` that starts with `probe-`. If you verify signatures, answer a valid ping with `2xx` as usual.

```javascript Node.js theme={null}
const crypto = require('crypto');

const TOLERANCE_SECONDS = 300; // reject anything older or newer than 5 minutes

// secrets: every secret you currently hold for this subscription (usually one).
// rawBody: the request body exactly as received (Buffer), before any JSON parsing.
function verifyLoftyWebhook(secrets, headers, rawBody) {
  const id = headers['webhook-id'];
  const timestamp = headers['webhook-timestamp'];
  const signatureHeader = headers['webhook-signature'];
  if (!id || !timestamp || !signatureHeader) return false;

  const age = Math.abs(Date.now() / 1000 - Number(timestamp));
  if (!Number.isFinite(age) || age > TOLERANCE_SECONDS) return false;

  const signedContent = Buffer.concat([Buffer.from(`${id}.${timestamp}.`), rawBody]);
  const received = signatureHeader.split(' ').map((s) => s.split(',')).filter(([v]) => v === 'v1');

  return secrets.some((secret) => {
    const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64');
    const expected = crypto.createHmac('sha256', key).update(signedContent).digest();
    return received.some(([, sig]) => {
      const given = Buffer.from(sig || '', 'base64');
      return given.length === expected.length && crypto.timingSafeEqual(given, expected);
    });
  });
}
```

```python Python theme={null}
import base64
import hashlib
import hmac
import time

TOLERANCE_SECONDS = 300  # reject anything older or newer than 5 minutes


def verify_lofty_webhook(secrets, headers, raw_body):
    """secrets: every secret you hold for this subscription (usually one).
    raw_body: the request body exactly as received (bytes), before JSON parsing."""
    msg_id = headers.get("webhook-id")
    timestamp = headers.get("webhook-timestamp")
    signature_header = headers.get("webhook-signature")
    if not (msg_id and timestamp and signature_header):
        return False
    try:
        age = abs(time.time() - float(timestamp))
    except ValueError:
        return False
    if age > TOLERANCE_SECONDS:
        return False

    signed_content = f"{msg_id}.{timestamp}.".encode() + raw_body
    received = [s.split(",", 1) for s in signature_header.split(" ")]
    received = [sig for version, sig in (r for r in received if len(r) == 2) if version == "v1"]

    for secret in secrets:
        key = base64.b64decode(secret.removeprefix("whsec_"))
        expected = base64.b64encode(hmac.new(key, signed_content, hashlib.sha256).digest()).decode()
        if any(hmac.compare_digest(sig, expected) for sig in received):
            return True
    return False
```

A receiver can only verify a request whose body it has not changed. In Express, read the body with `express.raw()` on the webhook route instead of `express.json()`; see the [example receiver](#example-receiver).

### Rotate the secret

Call `POST /v1.0/webhook/{subscribeId}/secret/rotate` to get a new secret. An API key needs the **Rotate a webhook signing secret** permission (under Webhooks) for this call. It is a separate permission, and keys that can already create webhooks get it automatically. Do this when:

* the subscription was created before signing existed and you want to switch signing on for it, or
* a secret may have leaked.

```json theme={null}
{
  "subscribeId": 1234,
  "secret": "whsec_bG9mdHktc2FtcGxlLXNpZ25pbmctc2VjcmV0LTAwMDE=",
  "previousSecretExpiresAt": "2026-11-30T08:00:00Z"
}
```

The new `secret` is shown only in this response. The **previous secret keeps signing for 7 days**, until `previousSecretExpiresAt`. During that time every delivery carries a signature for both secrets, so you can switch without downtime: deploy the new secret, and the old one stops being needed. Only the user who created the subscription, or another user of the same integration (vendor) in the same team, can rotate its secret.

> [!NOTE]
>
> The rotate call has no request body, but like every non-GET call to the API it must still send `Content-Type: application/json`. Without it the API answers `400` with code `20001` ("Content-type must be: application/json"). The same applies to `DELETE /v1.0/webhook/{subscribeId}`.

Subscriptions created before signing existed are **not signed** and are not changed in any way: their deliveries stay exactly as they were, with no new headers. Calling the rotate endpoint once is what switches signing on for such a subscription, and from then on its deliveries carry the signature headers. That first rotation has no previous secret, so the response has no `previousSecretExpiresAt` and each delivery carries a single signature.

### Custom authentication header

Some receivers sit behind an API gateway that only accepts a fixed credential, such as an `Authorization` header, and cannot check a signature. For them, add an `authHeader` when you create the subscription:

```json theme={null}
{
  "listId": 2,
  "callbackUrl": "https://your-app.example.com/webhooks/lofty",
  "authHeader": { "name": "Authorization", "value": "Bearer partner-gateway-token" }
}
```

Lofty adds this header to every delivery and ping probe of that subscription, together with the signature headers. It is an addition, not a replacement: the signature is the only check that also proves the body was not changed.

| Rule | Detail |
| - | - |
| Write-only | Stored encrypted. The API never returns it, and you cannot read it back. To change it, create a new subscription |
| Name | Letters, digits and hyphens, up to 64 characters |
| Not allowed as a name | `Host`, `Content-Type`, `Content-Length`, `Transfer-Encoding` and other transport headers, and anything starting with `webhook-` or `Lofty-` |
| Value | Printable ASCII, up to 512 characters, no line breaks |

An invalid `authHeader` is rejected with `INVALID_PARAMETER`.

### What changes for existing integrations

Nothing, unless you choose it. A subscription created before signing existed keeps receiving exactly the requests it receives today: same body, same URL, same headers, no signature. Signing starts for it only when you [rotate its secret](#rotate-the-secret). If your callback URL already carries a token, it keeps working, and so does everything else you rely on today, such as `Lofty-Webhook-Id` for deduplication.

New subscriptions are signed from the start. Each signed request carries about 200 bytes of extra headers, so a gateway that allows only a fixed list of request headers must allow `webhook-id`, `webhook-timestamp` and `webhook-signature`. We recommend signature verification over a token in the URL, but nothing forces you to move.

## Delivery timing

Events to a healthy endpoint are typically delivered within **1 minute** of the triggering change.

Actual delivery speed depends on your endpoint. Lofty delivers to each endpoint over a limited number of concurrent connections, so a slow handler queues its own events: an endpoint that responds in under a second keeps up with any volume, while one that takes several seconds per request can fall minutes behind at peak — see the throughput note under [Best practices](#best-practices).

Failed deliveries follow the [retry schedule](#retry-schedule) below. Deliveries to a disabled subscription pause and resume automatically after recovery — see [Health probes](#health-probes-and-automatic-recovery).

## Retries and failure handling

A delivery counts as successful when your endpoint returns any **2xx** status code. Any other response — an error status, a timeout, or a connection failure — is handled by the rules in this section.

### Retry schedule

Failed deliveries are retried up to **9 total attempts within 48 hours**, with exponential backoff between attempts:

| Attempt | Delay after previous failure |
| - | - |
| 2 | 30 seconds |
| 3 | 2 minutes |
| 4 | 10 minutes |
| 5 | 30 minutes |
| 6 | 2 hours |
| 7 | 6 hours |
| 8 | 12 hours |
| 9 | 24 hours |

Each delay includes ±20% random jitter so retries from many events don't arrive in synchronized bursts. An event that still cannot be delivered **48 hours** after it was created is discarded.

### Response handling

| Your response | What Lofty does |
| - | - |
| `2xx` | Delivered — no further attempts |
| `408`, `429`, `5xx`, timeout, connection error | Retried on the schedule above |
| `429` with a `Retry-After` header | Retried after the delay you request (minimum 60 seconds, capped at 1 hour) |
| `410 Gone` | The subscription is **disabled immediately** — return 410 when you decommission an endpoint |
| Any other `4xx` | Not retried — the event is discarded |

### Idempotent delivery

Every delivery request carries a `Lofty-Webhook-Id` header, and a signed subscription also receives the same value in `webhook-id`. It is unique per event and **stable across retries**. If a timeout caused your response to be lost, the retry arrives with the same id — use it to deduplicate instead of processing the event twice. The `webhook-timestamp` header is the exception: it changes on each attempt.

### Endpoint health and automatic disabling

Lofty tracks delivery health per subscription and disables a subscription automatically when:

* your endpoint returns **410 Gone** — immediately, or
* deliveries fail **continuously with no successes in between** — within hours for high-volume endpoints, or after roughly a day of sustained failures otherwise.

While a subscription is disabled, Lofty stops attempting deliveries to it. Pending events wait for recovery but still expire 48 hours after creation.

### Health probes and automatic recovery

Disabled subscriptions receive a **ping probe** approximately every 6 hours:

```json theme={null}
{ "eventType": "ping", "webhookId": 123456 }
```

The first probe that gets a 2xx response re-enables the subscription, and all pending unexpired events are delivered immediately. No manual action is needed on either side.

> [!WARNING]
>
> **Your receiver must return 2xx to ping probes.** If your endpoint rejects unrecognized event types with an error status, a disabled subscription can never recover automatically. Acknowledge first, then ignore event types you don't handle.

## Notification recipients

Which subscribed users receive a callback depends on the subscription's delivery mode (`permissionMode`). In both modes, only users in the lead's team who have subscribed to the event type are considered.

### Assignment-based delivery — `permissionMode: 0` (default)

A subscriber receives the callback only for leads assigned to them or that they administer:

* **Hidden leads** — only the assigned agent receives the notification.
* **Other leads** — the subscriber receives it if they are the assigned agent, or a Company Owner / Company Admin. All other subscribers are excluded.

### Ownership-based delivery — `permissionMode: 1`

A subscriber receives the callback for any lead they manage, regardless of who it is assigned to:

* Every assignment-based case above still applies (assigned agent, Company Owner / Company Admin).
* In addition, the subscriber receives the callback for any lead within their **ownership scope** — owned by their team or office, or personally owned by them — even if it is assigned to someone else.
* Hidden leads are still delivered only to users who manage them.

Ownership-based mode is intended for team/account-level integrations that need to cover every lead in their scope, not only assigned leads. Set `permissionMode` when creating the subscription; it defaults to `0`, so existing subscriptions are unaffected.

## Payload structure

Every callback body is a JSON object with two common fields plus one or more **action keys** that carry the events. There is no generic `events` array: read the action keys for the subscription's `listId`.

| Field | Type | Description |
| - | - | - |
| `teamId` | integer | Team ID where the event occurred |
| `listId` | integer | Event type ID (1–13) |

Action keys by event type. Only the keys for actions that happened in the batch are present:

| listId | Action keys | Value |
| - | - | - |
| 1 | `updatedAgent` | Array (also used for newly created agents) |
| 2 | `createdLead`, `updatedLead`, `deletedLead` | Array |
| 3 | `updatedLead` | Array |
| 4 | `alertId` | Single integer, not an array |
| 5 | `createdTransaction`, `updatedTransaction`, `deletedTransaction` | Array |
| 6 | `createdCall` | Array |
| 7 | `createdEmail` | Array |
| 8 | `createdText` | Array |
| 9 | `createdNote` | Array |
| 9 | `updatedNote`, `deletedNote` | **Single object**, not an array |
| 10 | `createdTask`, `updatedTask`, `finishedTask`, `deletedTask` | Array |
| 11 | `createdAppt`, `updatedAppt`, `finishedAppt`, `deletedAppt` | Array |
| 12 | `updatedLeadstage` | Array |
| 13 | `createdShowing`, `updatedShowing`, `createdShowingFeedback` | Array |

> [!WARNING]
>
> Normalize before iterating: `updatedNote` and `deletedNote` are objects and Listing Alert's `alertId` is a number, so code that assumes every action key holds an array will skip or crash on them. The [example receiver](#example-receiver) shows one way to handle this.

A ping probe is the exception to this structure: its body is `{"eventType": "ping", "webhookId": 123456}` (see [Health probes](#health-probes-and-automatic-recovery)).

## Event types

| listId | Event | Triggers |
| - | - | - |
| 1 | Agent Info | Agent created or updated |
| 2 | Lead Info | Lead created, updated, or deleted |
| 3 | Lead Activity | Lead site activity (browse, favorite, search) |
| 4 | Listing Alert | Listing alert changed |
| 5 | Transaction | Transaction created, updated, or deleted |
| 6 | Call | Call event (MANUAL and LOGGED only, excludes AUTO) |
| 7 | Email | Email event (MANUAL and LOGGED only, excludes AUTO) |
| 8 | Text | Text message event (MANUAL and LOGGED only, excludes AUTO) |
| 9 | Note | Note created, updated, or deleted |
| 10 | Task | Task created, updated, finished, or deleted |
| 11 | Appointment | Appointment created, updated, finished, or deleted |
| 12 | Pipeline Change | Lead pipeline stage changed |
| 13 | Showing | Showing created, updated or cancelled; showing feedback added |

> [!WARNING]
>
> **Call, Email, and Text webhooks do not fire for AUTO communications.** Only agent-initiated (`MANUAL`) and after-the-fact logged (`LOGGED`) events trigger webhooks. Automated messages sent by Lofty (drip campaigns, auto-responders, Smart Plans, etc.) are excluded. If your integration depends on tracking all communications, you must also poll the Communication API for `AUTO` type events.

***

## Event payloads

### 1. Agent Info

Triggered when an agent is created or updated.

```json theme={null}
{
  "teamId": 123456,
  "listId": 1,
  "updatedAgent": [
    {
      "agentUserId": 789,
      "updateTime": 1736935800000
    }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `updatedAgent` | array | List of updated agent records |
| `updatedAgent[].agentUserId` | integer | User ID of the updated agent |
| `updatedAgent[].updateTime` | integer | Epoch milliseconds of the update |

### 2. Lead Info

Triggered when a lead is created, updated, or deleted. Only the relevant action fields are present.

```json theme={null}
{
  "teamId": 123456,
  "listId": 2,
  "createdLead": [
    { "leadId": 456, "updateTime": 1736935800000 }
  ],
  "updatedLead": [
    { "leadId": 457, "updateTime": 1736935860000 }
  ],
  "deletedLead": [
    { "leadId": 458, "updateTime": 1736935920000 }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `createdLead` | array | Created leads (present on create) |
| `updatedLead` | array | Updated leads (present on update) |
| `deletedLead` | array | Deleted leads (present on delete) |
| `[].leadId` | integer | Lead ID |
| `[].updateTime` | integer | Epoch milliseconds of the change |

### 3. Lead Activity

Triggered when a lead performs site activity (SiteBrowse, SiteFavorite, SiteSearch, etc.).

```json theme={null}
{
  "teamId": 123456,
  "listId": 3,
  "updatedLead": [
    { "leadId": 456, "updateTime": 1736935800000 }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `updatedLead` | array | Leads with new activity |
| `updatedLead[].leadId` | integer | Lead ID |
| `updatedLead[].updateTime` | integer | Epoch milliseconds of the activity |

### 4. Listing Alert

Triggered when a listing alert changes.

```json theme={null}
{
  "teamId": 123456,
  "listId": 4,
  "alertId": 789
}
```

| Field | Type | Description |
| - | - | - |
| `alertId` | integer | ID of the changed alert |

### 5. Transaction

Triggered when a transaction is created, updated, or deleted. Only the relevant action fields are present.

```json theme={null}
{
  "teamId": 123456,
  "listId": 5,
  "createdTransaction": [
    {
      "leadId": 456,
      "transactionId": 789,
      "updateTime": 1736935800000
    }
  ],
  "updatedTransaction": [
    {
      "leadId": 457,
      "transactionId": 790,
      "updateTime": 1736935860000,
      "updatedField": { "fieldName": "newValue" },
      "updatedFields": [{ "fieldName": "newValue" }]
    }
  ],
  "deletedTransaction": [
    {
      "leadId": 458,
      "transactionId": 791,
      "updateTime": 1736935920000
    }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `createdTransaction` | array | Created transactions (present on create) |
| `updatedTransaction` | array | Updated transactions (present on update) |
| `deletedTransaction` | array | Deleted transactions (present on delete) |
| `[].leadId` | integer | Associated lead ID |
| `[].transactionId` | integer | Transaction ID |
| `[].updateTime` | integer | Epoch milliseconds of the change |
| `[].updatedField` | object | Changed field key-value pair (nullable) |
| `[].updatedFields` | array | List of changed field key-value pairs (nullable) |

### 6. Call

Triggered on a call event.

```json theme={null}
{
  "teamId": 123456,
  "listId": 6,
  "createdCall": [
    {
      "callId": 101,
      "timelineId": 9876,
      "leadId": 456,
      "updateTime": 1736935800000,
      "agentId": 789,
      "communicationType": "MANUAL"
    }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `createdCall` | array | Call event records |
| `[].callId` | integer | Dialer call record ID (`MANUAL`) or timeline ID (`LOGGED`). Kept for backward compatibility — prefer `timelineId` for new integrations. |
| `[].timelineId` | integer | Lead timeline row ID for this call event. Always `lead_timeline.id` regardless of `communicationType`. Pass as `communicationId` to `GET /v2.0/communication/call/{communicationId}` to fetch the full record. |
| `[].leadId` | integer | Associated lead ID |
| `[].updateTime` | integer | Epoch milliseconds of the call |
| `[].agentId` | integer | Agent user ID |
| `[].communicationType` | string | `MANUAL` or `LOGGED` |

### 7. Email

Triggered on an email event.

```json theme={null}
{
  "teamId": 123456,
  "listId": 7,
  "createdEmail": [
    {
      "emailId": 101,
      "timelineId": 9876,
      "leadId": 456,
      "updateTime": 1736935800000,
      "agentId": 789,
      "communicationType": "MANUAL"
    }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `createdEmail` | array | Email event records |
| `[].emailId` | integer | Email record ID (`MANUAL`) or timeline ID (`LOGGED`). Kept for backward compatibility — prefer `timelineId` for new integrations. |
| `[].timelineId` | integer | Lead timeline row ID for this email event. Always `lead_timeline.id` regardless of `communicationType`. Pass as `communicationId` to `GET /v2.0/communication/email/{communicationId}` to fetch the full record. |
| `[].leadId` | integer | Associated lead ID |
| `[].updateTime` | integer | Epoch milliseconds of the event |
| `[].agentId` | integer | Agent user ID |
| `[].communicationType` | string | `MANUAL` or `LOGGED` |

### 8. Text

Triggered on a text/SMS event.

```json theme={null}
{
  "teamId": 123456,
  "listId": 8,
  "createdText": [
    {
      "textId": 101,
      "timelineId": 9876,
      "leadId": 456,
      "updateTime": 1736935800000,
      "agentId": 789,
      "communicationType": "MANUAL"
    }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `createdText` | array | Text message event records |
| `[].textId` | integer | SMS record ID (`MANUAL`) or timeline ID (`LOGGED`). Kept for backward compatibility — prefer `timelineId` for new integrations. |
| `[].timelineId` | integer | Lead timeline row ID for this text event. Always `lead_timeline.id` regardless of `communicationType`. Pass as `communicationId` to `GET /v2.0/communication/text/{communicationId}` to fetch the full record. |
| `[].leadId` | integer | Associated lead ID |
| `[].updateTime` | integer | Epoch milliseconds of the event |
| `[].agentId` | integer | Agent user ID |
| `[].communicationType` | string | `MANUAL` or `LOGGED` |

> [!NOTE]
>
> **communicationType values** — `MANUAL`: agent-initiated communication. `LOGGED`: communication recorded after the fact. `AUTO` events are excluded from webhooks.

### 9. Note

Triggered when a note is created, updated, or deleted. Only the relevant action fields are present.

```json theme={null}
{
  "teamId": 123456,
  "listId": 9,
  "createdNote": [
    {
      "noteId": 101,
      "leadId": 456,
      "updateTime": 1736935800000,
      "noteType": "Manual",
      "agentId": 789
    }
  ],
  "updatedNote": {
    "noteId": 102,
    "leadId": 457,
    "updateTime": 1736935860000,
    "noteType": "Manual",
    "agentId": 789
  },
  "deletedNote": {
    "noteId": 103,
    "leadId": 458,
    "updateTime": 1736935920000,
    "noteType": "Manual",
    "agentId": 789
  }
}
```

| Field | Type | Description |
| - | - | - |
| `createdNote` | array | Created notes (present on create) |
| `updatedNote` | object | Updated note (present on update) |
| `deletedNote` | object | Deleted note (present on delete) |
| `[].noteId` | integer | Note ID |
| `[].leadId` | integer | Associated lead ID |
| `[].updateTime` | integer | Epoch milliseconds of the change |
| `[].noteType` | string | `Manual`, `System`, or `AI` |
| `[].agentId` | integer | Agent user ID |

### 10. Task

Triggered when a task is created, updated, finished, or deleted. Multiple action fields may appear in a single payload.

```json theme={null}
{
  "teamId": 123456,
  "listId": 10,
  "createdTask": [
    { "taskId": 101, "leadId": 456, "updateTime": 1736935800000 }
  ],
  "updatedTask": [
    { "taskId": 102, "leadId": 457, "updateTime": 1736935860000 }
  ],
  "finishedTask": [
    { "taskId": 103, "leadId": 458, "updateTime": 1736935920000 }
  ],
  "deletedTask": [
    { "taskId": 104, "leadId": 459, "updateTime": 1736935980000 }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `createdTask` | array | Created tasks (present on create) |
| `updatedTask` | array | Updated tasks (present on update) |
| `finishedTask` | array | Finished tasks (present on finish) |
| `deletedTask` | array | Deleted tasks (present on delete) |
| `[].taskId` | integer | Task ID |
| `[].leadId` | integer | Associated lead ID |
| `[].updateTime` | integer | Epoch milliseconds of the change |

### 11. Appointment

Triggered when an appointment is created, updated, finished, or deleted. Multiple action fields may appear in a single payload.

```json theme={null}
{
  "teamId": 123456,
  "listId": 11,
  "createdAppt": [
    { "apptId": 101, "leadId": 456, "updateTime": 1736935800000 }
  ],
  "updatedAppt": [
    { "apptId": 102, "leadId": 457, "updateTime": 1736935860000 }
  ],
  "finishedAppt": [
    { "apptId": 103, "leadId": 458, "updateTime": 1736935920000 }
  ],
  "deletedAppt": [
    { "apptId": 104, "leadId": 459, "updateTime": 1736935980000 }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `createdAppt` | array | Created appointments (present on create) |
| `updatedAppt` | array | Updated appointments (present on update) |
| `finishedAppt` | array | Finished appointments (present on finish) |
| `deletedAppt` | array | Deleted appointments (present on delete) |
| `[].apptId` | integer | Appointment ID |
| `[].leadId` | integer | Associated lead ID |
| `[].updateTime` | integer | Epoch milliseconds of the change |

### 12. Pipeline Change

Triggered when a lead's pipeline stage changes.

```json theme={null}
{
  "teamId": 123456,
  "listId": 12,
  "updatedLeadstage": [
    {
      "leadId": 456,
      "updateTime": 1736935800000,
      "changeInfo": {
        "oldstage": "New Lead",
        "newstage": "Contacted"
      }
    }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `updatedLeadstage` | array | Pipeline stage change records |
| `[].leadId` | integer | Lead ID |
| `[].updateTime` | integer | Epoch milliseconds of the stage change |
| `[].changeInfo.oldstage` | string | Previous pipeline stage name |
| `[].changeInfo.newstage` | string | New pipeline stage name |

***

### 13. Showing

Triggered when a property showing on a lead is created, changed or cancelled, and when feedback is added to one. Covers showings created through [`POST /v2.0/showings`](https://developer.lofty.com/api-reference/showings/v2/create-showing) as well as showings created inside Lofty. The payload mirrors `GET /v2.0/showings/{id}`: statuses are the same strings, times are ISO 8601 UTC.

Exactly one of the three event keys is present per callback:

| Key | When |
| - | - |
| `createdShowing` | A showing was created (by a partner through the API, or inside Lofty) |
| `updatedShowing` | Time, status or note changed, including cancellation and the automatic cancellation when the listing sells. Carries `previousStatus`. |
| `createdShowingFeedback` | Feedback was added through the API. Carries `feedbackId`. |

```json theme={null}
{
  "teamId": 123456,
  "listId": 13,
  "updatedShowing": [
    {
      "id": "987654321",
      "leadId": "563172647619608",
      "listingId": "1125978285514250",
      "status": "cancelled",
      "previousStatus": "scheduled",
      "startAt": "2026-11-01T17:00:00Z",
      "endAt": "2026-11-01T17:30:00Z",
      "source": "20001",
      "externalId": "showami-98765",
      "operatorId": "77",
      "updateTime": "2026-10-26T08:00:00Z"
    }
  ]
}
```

| Field | Type | Description |
| - | - | - |
| `[].id` | string | Showing ID |
| `[].leadId` | string | Lead ID |
| `[].listingId` | string | Lofty listing ID, or the external property record ID when no Lofty listing matched |
| `[].status` | string | `requested`, `scheduled`, `in_progress`, `completed`, `denied`, `expired` or `cancelled` |
| `[].previousStatus` | string | `updatedShowing` only: the status before the change |
| `[].startAt` / `[].endAt` | string | ISO 8601 UTC |
| `[].source` | string | Vendor ID of the partner that created the showing; `null` for showings created inside Lofty. Use it to ignore callbacks caused by your own writes. |
| `[].externalId` | string | The partner's own ID for the showing; `null` for showings created inside Lofty |
| `[].feedbackId` | string | `createdShowingFeedback` only: ID of the new feedback entry; fetch it with `GET /v2.0/showings/{id}/feedback` |
| `[].operatorId` | string | Lofty user who triggered the change; `null` for system actions such as the listing selling |
| `[].updateTime` | string | ISO 8601 UTC time of the change |

> [!NOTE]
>
> Showings created inside Lofty move from `scheduled` to `in_progress`, `completed` or `expired` by the clock, not by an explicit action, and no webhook fires for those transitions. Showings created through the API never change status by the clock.

***

## Best practices

**Respond immediately.** Return a `2xx` before processing and move your logic to a background job. Lofty limits concurrent deliveries per endpoint, so a slow handler directly reduces your delivery throughput — at high event volume, synchronous processing is the most common cause of delayed webhooks.

**Handle duplicates.** The same event may be delivered more than once (for example, when a timeout swallowed your response). Deduplicate with the `Lofty-Webhook-Id` header — it is stable across retries of the same event.

**Don't assume ordering.** Retries mean an older event can arrive after a newer one. Order by the `updateTime` field inside the payload, not by arrival time.

**Acknowledge pings.** Return `2xx` to `{"eventType": "ping"}` probes — they are how a disabled subscription recovers automatically.

**Decommission cleanly.** When you shut an endpoint down for good, return `410 Gone` so Lofty stops delivering immediately instead of retrying against a dead URL.

**Verify signatures.** Check `webhook-signature` against the raw body before you trust a request, and reject a stale `webhook-timestamp`. See [Verify webhook signatures](#verify-webhook-signatures).

**Validate payloads.** Check that `listId` matches your expected event type before processing.

**Use HTTPS.** The callback carries lead data, so serve it over HTTPS from a publicly reachable host.

> [!TIP]
>
> Use [ngrok](https://ngrok.com) during development to tunnel webhooks to your local machine.

## Example receiver

```javascript theme={null}
const express = require('express');
const { verifyLoftyWebhook } = require('./verify'); // the function from "Verify webhook signatures"

const app = express();
const SECRETS = [process.env.LOFTY_WEBHOOK_SECRET]; // whsec_..., add the old one during a rotation

// Keep the raw bytes: the signature is computed over them, not over parsed JSON.
app.post('/webhooks/lofty', express.raw({ type: '*/*', limit: '5mb' }), (req, res) => {
  if (!verifyLoftyWebhook(SECRETS, req.headers, req.body)) {
    return res.sendStatus(401);
  }
  res.sendStatus(200); // ack first — this also covers ping probes
  const payload = JSON.parse(req.body.toString('utf8'));
  if (payload.eventType === 'ping') return;
  processPayload(req.get('webhook-id'), payload).catch(console.error);
});

async function processPayload(webhookId, payload) {
  // Skip if webhookId was already processed (retries reuse the same id).
  const { teamId, listId, ...actions } = payload;
  for (const [action, value] of Object.entries(actions)) {
    // Most action keys hold an array; updatedNote/deletedNote hold one object
    // and Listing Alert sends a plain alertId number.
    const items = Array.isArray(value) ? value : [value];
    for (const item of items) {
      console.log(`team ${teamId}, listId ${listId}, ${action}:`, item);
    }
  }
}

app.listen(3000);
```

## Resolving communication events to full records

After receiving a Call / Email / Text webhook, fetch the full record by passing the event's `timelineId` as the `communicationId` path parameter of the v2 by-ID endpoint:

| Webhook event | Lookup endpoint | Response |
| - | - | - |
| Call | `GET /v2.0/communication/call/{communicationId}` | `CallResponse` |
| Email | `GET /v2.0/communication/email/{communicationId}` | `EmailResponse` |
| Text | `GET /v2.0/communication/text/{communicationId}` | `TextResponse` |

`timelineId` is the recommended round-trip key — it always points to the same `lead_timeline` row regardless of whether the event is `MANUAL` or `LOGGED`. The legacy `callId` / `emailId` / `textId` fields still ship for backward compatibility, but their underlying record changes between the two `communicationType` values, so they are not safe to pass to the v2 by-ID endpoints.

> [!NOTE]
>
> All IDs in webhook payloads are 64-bit integers. JavaScript clients must handle them carefully — see [JS / TS Integration](https://developer.lofty.com/javascript-integration.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.