Skip to main content
Webhooks allow your application or agent to receive real-time push notifications when key events occur inside Leadterra, eliminating the need to poll the API. When you register a webhook, you provide an HTTPS URL and a list of event types you want to subscribe to. Leadterra will send an HTTP POST request to that URL each time one of those events fires, delivering a structured JSON payload with the full event context. You can register multiple webhooks with different URLs and event sets to fan events out to several downstream systems simultaneously.

Endpoint

Authorization

All requests must include a valid API key in the Authorization header as a Bearer token.

Request Body

string
required
The HTTPS URL that Leadterra will POST event payloads to. Must use the https:// scheme. Plain HTTP URLs are rejected to protect the integrity of event data in transit.
array
required
An array of event type strings that this webhook should subscribe to. At least one event must be specified. Valid values are:
  • campaign.started — fires when a campaign transitions to active and begins sending.
  • message.sent — fires each time an individual outbound email is successfully handed off to the mail provider.
  • message.bounced — fires when a sent message receives a hard or soft bounce notification.
  • reply.received — fires when an inbound reply is received and classified by Leadterra.

Example Request

Response Fields

string
The unique identifier assigned to this webhook registration. Store this value if you need to reference or delete the webhook later.
string
The HTTPS URL you registered, echoed back for confirmation.
array
The list of event type strings this webhook is subscribed to, echoed back for confirmation.
string
The current status of the webhook. A newly registered webhook always returns active.
string
ISO 8601 timestamp indicating when the webhook was registered.

Example Response

Webhook Payload Structure

Every event Leadterra delivers to your endpoint shares a common envelope with an event type field, a timestamp, and an data object whose shape depends on the event type. Below is a sample payload for the reply.received event — the most commonly used event in agent-driven workflows.
Your endpoint must return an HTTP 2xx status code within 10 seconds to acknowledge receipt. Any non-2xx response or a timeout is treated as a delivery failure and triggers the retry schedule described below.

Retry Behavior

If Leadterra does not receive a 2xx response from your endpoint, the delivery is considered failed and will be retried automatically using exponential backoff. The retry schedule is as follows: After five failed attempts, the event is marked as permanently undelivered and no further retries are made. Leadterra does not currently emit an alert when a webhook enters a persistent failure state, so we recommend monitoring your endpoint’s availability and inspecting delivery logs in the dashboard under Settings → Webhooks. To prevent duplicate processing on your side, ensure your event handler is idempotent — use the replyId, campaignId, or other stable identifiers in the payload to detect and discard re-delivered events.
Drive agent workflows with webhook events. Registering a reply.received webhook is the most effective way to trigger an AI agent the moment a lead expresses interest. When your endpoint receives a payload with classification: "interested", you can pass the threadSnippet and lead context directly into your agent’s prompt, then use the Leadterra API to enrich the lead record or pause the sequence while a human or agent follows up — all without polling.

Error Codes