Outgoing Webhooks
Outgoing webhooks allow you to receive real-time HTTP notifications when events occur in your workspace. When an event fires, CampaignLark sends a POST request to your configured endpoint with a JSON payload describing the event.
Outgoing webhooks are ideal for:
- Syncing contact data to external CRMs
- Triggering workflows in automation platforms
- Logging engagement events to analytics systems
- Building custom integrations and workflows
Webhook Delivery
Request Format
All webhook deliveries are sent as POST requests with the following headers:
| Header | Value |
|---|---|
Content-Type | application/json |
X-Webhook-Signature | HMAC-SHA256 hex digest of the request body |
User-Agent | CampaignLark/1.0 (+https://campaignlark.com) |
Envelope
Every webhook delivery follows this envelope structure:
{
"id": "evt_69b27e24be03b743d4b9b7b7",
"event_type": "contact.created",
"workspace_id": 12,
"created_at": "2026-03-12T08:49:40.208Z",
"data": { ... }
}
| Field | Type | Description |
|---|---|---|
id | string | Unique event ID, prefixed with evt_ |
event_type | string | The event type that triggered this delivery |
workspace_id | integer | The workspace where the event occurred |
created_at | string | ISO 8601 timestamp of when the event was created |
data | object | Event-specific payload (see below) |
Verifying Signatures
Every webhook includes an X-Webhook-Signature header containing an HMAC-SHA256 hex digest of the raw request body, signed with your webhook secret. Always verify this signature before processing the payload to ensure the request came from CampaignLark.
- JavaScript
- Python
- Go
- PHP
- Ruby
- C#
const crypto = require("crypto");
function verifyWebhookSignature(body, signature, secret) {
const expected = crypto
.createHmac("sha256", secret)
.update(body)
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
import hmac
import hashlib
def verify_webhook_signature(body: bytes, signature: str, secret: str) -> bool:
expected = hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
return hmac.compare_digest(signature, expected)
package main
import (
"crypto/hmac"
"crypto/sha256"
"crypto/subtle"
"encoding/hex"
)
func verifyWebhookSignature(body []byte, signature string, secret string) bool {
mac := hmac.New(sha256.New, []byte(secret))
mac.Write(body)
expected := hex.EncodeToString(mac.Sum(nil))
return subtle.ConstantTimeCompare([]byte(signature), []byte(expected)) == 1
}
<?php
function verifyWebhookSignature($body, $signature, $secret) {
$expected = hash_hmac('sha256', $body, $secret);
return hash_equals($signature, $expected);
}
require 'openssl'
def verify_webhook_signature(body, signature, secret)
expected = OpenSSL::HMAC.hexdigest('SHA256', secret, body)
Rack::Utils.secure_compare(signature, expected)
end
using System;
using System.Security.Cryptography;
using System.Text;
public static bool VerifyWebhookSignature(string body, string signature, string secret)
{
using (var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(secret)))
{
var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(body));
var expected = BitConverter.ToString(hash).Replace("-", "").ToLower();
return CryptographicOperations.FixedTimeEquals(
Encoding.UTF8.GetBytes(signature),
Encoding.UTF8.GetBytes(expected)
);
}
}
Retry Policy
Your endpoint must respond with a 2xx status code to acknowledge receipt. If delivery fails (non-2xx response or network error), CampaignLark retries with the following backoff schedule:
| Attempt | Delay |
|---|---|
| 1 | Immediate |
| 2 | 5 seconds |
| 3 | 1 minute |
| 4 | 5 minutes |
| 5 | 10 minutes |
| 6 | 30 minutes |
| 7 | 1 hour |
| 8 | 4 hours |
After 8 failed attempts, the delivery is permanently discarded. Your endpoint must respond within 10 seconds or the delivery will be treated as a failure.
The complete retry cycle spans approximately 5.5 hours from the initial attempt to the final retry.
The Contact Object
Many events include a contact object. This object always has the same shape, regardless of the event type:
{
"id": "69b27e24be03b743d4b9b7b3",
"status": "SUBSCRIBED",
"sms_status": "SUBSCRIBED",
"fields": {
"email_address": "jane@example.com",
"first_name": "Jane",
"last_name": "Doe",
"phone_number": null,
"country": null
},
"tags": [
{ "id": 1, "name": "VIP" },
{ "id": 5, "name": "Newsletter" }
],
"created_at": "2026-03-12T08:34:16Z",
"updated_at": "2026-03-12T08:49:40Z"
}
| Field | Type | Description |
|---|---|---|
id | string | The contact's unique ID |
status | string | One of SUBSCRIBED, UNCONFIRMED, UNSUBSCRIBED, CLEANED, COMPLAINED |
sms_status | string | One of SUBSCRIBED, UNSUBSCRIBED, CLEANED, BLOCKED |
fields | object | Map of merge tag to value. Unset fields are null. |
tags | array | Array of { id, name } objects for each tag assigned to the contact |
created_at | string | ISO 8601 timestamp |
updated_at | string | ISO 8601 timestamp |
last_opened_at | string? | ISO 8601 timestamp, present only if the contact has opened an email |
last_clicked_at | string? | ISO 8601 timestamp, present only if the contact has clicked a link |
unsubscribed_at | string? | ISO 8601 timestamp, present only if the contact has unsubscribed |
sms_unsubscribed_at | string? | ISO 8601 timestamp, present only if the contact has unsubscribed from SMS |
Event Types
Contact Lifecycle
contact.created
Fired when a new contact is created.
Payload: Contact Object
{
"id": "69b27e24be03b743d4b9b7b3",
"status": "SUBSCRIBED",
"fields": { "email_address": "jane@example.com", "first_name": "Jane" },
"tags": [],
"created_at": "2026-03-12T08:34:16Z",
"updated_at": "2026-03-12T08:34:16Z"
}
contact.updated
Fired when a contact's fields, status, or tags are modified.
Payload: Contact Object
{
"id": "69b27e24be03b743d4b9b7b3",
"status": "SUBSCRIBED",
"fields": { "email_address": "jane@example.com", "first_name": "Jane", "last_name": "Doe" },
"tags": [{ "id": 1, "name": "VIP" }],
"created_at": "2026-03-12T08:34:16Z",
"updated_at": "2026-03-12T09:15:00Z"
}
contact.deleted
Fired when a contact is deleted.
Payload: Contact Object (snapshot at time of deletion)
{
"id": "69b27e24be03b743d4b9b7b3",
"status": "SUBSCRIBED",
"fields": { "email_address": "jane@example.com", "first_name": "Jane" },
"tags": [{ "id": 1, "name": "VIP" }],
"created_at": "2026-03-12T08:34:16Z",
"updated_at": "2026-03-12T08:34:16Z"
}
contact.subscribed
Fired when a contact's status changes to SUBSCRIBED (e.g. via opt-in confirmation or resubscription).
Payload: Same as contact.created
contact.unsubscribed
Fired when a contact unsubscribes.
Payload: Same as contact.created
contact.sms_unsubscribed
Fired when a recipient uses the SMS unsubscribe link or replies STOP and the carrier reports the opt-out.
Payload: Contact Object
contact.sms_cleaned
Fired when a carrier says the phone number is dead or unreachable.
Payload: Contact Object
contact.sms_blocked
Fired when a carrier, regulator, or spam filter blocks an SMS message.
Payload: Contact Object
There is no contact.sms_subscribed event because SMS opt-in isn't tracked.
contact.cleaned
Fired when a contact is marked as cleaned due to a hard bounce.
Payload:
{
"contact": { ... },
"message_id": "abc123@mail.example.com",
"bounce_reason": "550 5.1.1 User unknown"
}
| Field | Type | Description |
|---|---|---|
contact | object | Contact Object |
message_id | string | The message ID of the bounced email |
bounce_reason | string | The bounce response message from the receiving server |
contact.complained
Fired when a contact reports an email as spam (feedback loop).
Payload:
{
"contact": { ... },
"message_id": "abc123@mail.example.com",
"campaign_id": "69b27e24be03b743d4b9b7b3"
}
| Field | Type | Description |
|---|---|---|
contact | object | Contact Object |
message_id | string | The message ID of the complained email |
campaign_id | string? | Campaign ID, if the email was sent from a campaign |
automation_id | string? | Automation ID, if the email was sent from an automation |
Tags
contact.tagged
Fired when one or more tags are added to a contact.
Payload:
{
"contact": { ... },
"modified_tags": [
{ "id": 1, "name": "VIP" },
{ "id": 5, "name": "Newsletter" }
]
}
| Field | Type | Description |
|---|---|---|
contact | object | Contact Object |
modified_tags | array | The tags that were added, each with id and name |
contact.untagged
Fired when one or more tags are removed from a contact.
Payload: Same as contact.tagged
Segments
contact.segment.entered
Fired when a contact enters a segment after a recalculation.
Payload:
{
"contact": { "id": "69b27e24be03b743d4b9b7b3" },
"segment": { "id": 4, "name": "Engaged Users" }
}
| Field | Type | Description |
|---|---|---|
contact | object | Contains only the contact id |
segment | object | The segment entered, with id and name |
Segment events provide a lightweight contact reference (id only) instead of the full contact object for performance reasons, as segment recalculations can affect thousands of contacts at once.
contact.segment.exited
Fired when a contact exits a segment after a recalculation.
Payload: Same as contact.segment.entered
Email Engagement
email.sent
Fired when an email is successfully delivered to the recipient's mail server.
Payload:
{
"contact_id": "69b27e24be03b743d4b9b7b3",
"message_id": "abc123@mail.example.com",
"campaign_id": "69b27e24be03b743d4b9b7b3"
}
| Field | Type | Description |
|---|---|---|
contact_id | string | The recipient contact ID |
message_id | string | The unique message ID assigned by the mail server |
campaign_id | string? | Present if the email was part of a campaign |
automation_id | string? | Present if the email was part of an automation |
email.opened
Fired when a contact opens an email.
Payload: Same structure as email.sent.
email.clicked
Fired when a contact clicks a link in an email.
Payload:
{
"contact_id": "69b27e24be03b743d4b9b7b3",
"message_id": "abc123@mail.example.com",
"campaign_id": "69b27e24be03b743d4b9b7b3",
"url": "https://example.com/offer"
}
| Field | Type | Description |
|---|---|---|
contact_id | string | The recipient contact ID |
message_id | string | The unique message ID |
campaign_id | string? | Present if the email was part of a campaign |
automation_id | string? | Present if the email was part of an automation |
url | string | The URL that was clicked |
email.bounced
Fired when an email bounces.
Payload:
{
"contact_id": "69b27e24be03b743d4b9b7b3",
"message_id": "abc123@mail.example.com",
"campaign_id": "69b27e24be03b743d4b9b7b3",
"bounce_type": "hard",
"bounce_reason": "550 5.1.1 User unknown"
}
| Field | Type | Description |
|---|---|---|
contact_id | string | The recipient contact ID |
message_id | string | The unique message ID |
campaign_id | string? | Present if the email was part of a campaign |
automation_id | string? | Present if the email was part of an automation |
bounce_type | string | The bounce category (e.g. hard, soft) |
bounce_reason | string | The response message from the receiving server |
SMS Engagement
sms.delivered
Fired when an SMS delivery receipt confirms that the message was delivered.
Payload:
{
"contact_id": "69b27e24be03b743d4b9b7b3",
"sms_campaign_id": "69b27e24be03b743d4b9b7b3",
"provider_message_id": "SM1234567890",
"delivered_at": "2026-03-12T08:49:40Z"
}
| Field | Type | Description |
|---|---|---|
contact_id | string | The recipient contact ID |
sms_campaign_id | string? | Present if the SMS was part of a campaign |
provider_message_id | string | The provider's message ID |
delivered_at | string | ISO 8601 timestamp from the delivery receipt |
sms.clicked
Fired when a contact clicks a link in an SMS.
Payload:
{
"contact_id": "69b27e24be03b743d4b9b7b3",
"sms_campaign_id": "69b27e24be03b743d4b9b7b3",
"provider_message_id": "SM1234567890",
"ip": "1.1.1.1",
"user_agent": "Mozilla/5.0",
"country": "AU",
"link_url": "https://example.com/offer"
}
| Field | Type | Description |
|---|---|---|
contact_id | string | The recipient contact ID |
sms_campaign_id | string? | Present if the SMS was part of a campaign |
provider_message_id | string | The provider's message ID |
ip | string | The visitor's IP address |
user_agent | string | The visitor's user agent |
country | string | Two-letter country code based on IP geolocation |
link_url | string | The URL that was clicked |
sms.failed
Fired when an SMS delivery receipt reports a failed delivery.
Payload:
{
"contact_id": "69b27e24be03b743d4b9b7b3",
"sms_campaign_id": "69b27e24be03b743d4b9b7b3",
"provider_message_id": "SM1234567890",
"failure_reason": "Twilio status: failed, ErrorCode: 30004",
"failed_at": "2026-03-12T08:49:40Z"
}
| Field | Type | Description |
|---|---|---|
contact_id | string | The recipient contact ID |
sms_campaign_id | string? | Present if the SMS was part of a campaign |
provider_message_id | string | The provider's message ID |
failure_reason | string | The provider failure reason |
failed_at | string | ISO 8601 timestamp from the delivery receipt |
sms.cleaned
Fired when a delivery receipt says the SMS number is dead or unreachable.
Payload: Same structure as sms.failed.
sms.blocked
Fired when a carrier, regulator, or spam filter blocks an SMS message.
Payload: Same structure as sms.failed.
A blocked or unreachable number fires sms.failed as well, in the same way a hard bounce fires both email.bounced and contact.cleaned. The narrower event tells you why the message failed; the contact-level contact.sms_cleaned or contact.sms_blocked event tells you the contact will no longer receive SMS.
Transactional Email
These events apply to emails sent through POST /v1/emails/send. They are separate from email.* events and follow the to recipient only; cc and bcc copies don't fire events. Payload id is the email tracking ID.
| Event | Fired when |
|---|---|
transactional_email.delivered | The recipient's mail server accepted the email. |
transactional_email.bounced | The email bounced. |
transactional_email.complained | The recipient marked the email as spam. |
transactional_email.failed | The email could not be sent, for example a rendering error or the plan's monthly limit. |
transactional_email.opened | The recipient opened the email. Only with track_opens. |
transactional_email.clicked | The recipient clicked a link. Only with track_clicks. |
Payload:
{
"id": "69b2a1f0be03b743d4b9b7c1",
"reference": "user-42",
"to": "jane@example.com",
"contact_id": "69a01c2fbe03b743d4b90011",
"status": "DELIVERED",
"bounce_type": "",
"failure_reason": "",
"timestamp": "2026-11-26T09:00:04Z"
}
| Field | Type | Description |
|---|---|---|
id | string | The email tracking ID returned by the send endpoint |
reference | string | Caller-supplied reference, or an empty string |
to | string | The to address |
contact_id | string or null | The linked contact, or null when to matched no contact |
status | string | The email's status after the event |
bounce_type | string | Bounce category on bounced, otherwise empty |
failure_reason | string | Bounce or failure reason, otherwise empty |
timestamp | string | Event time, UTC RFC3339 |
Transactional SMS
These events apply to messages sent directly to a phone number through POST /v1/sms/send. They are separate from sms.* events: transactional messages do not fire the contact/campaign SMS engagement events above, and their payload has no contact or campaign ID.
The examples below are the envelope's data object, like the other event payloads on this page. The standard envelope, signing, and retry rules still apply. Payload id is the SMS tracking ID; the envelope's id identifies the webhook delivery event.
transactional_sms.delivered
Fired when a delivery receipt confirms that a transactional SMS was delivered.
Payload:
{
"id": "69b27e24be03b743d4b9b7b3",
"reference": "lead-123",
"to": "+14155552671",
"status": "DELIVERED",
"parts": 1,
"charge": "0.01250",
"failure_reason": "",
"timestamp": "2026-03-12T08:49:40Z"
}
| Field | Type | Description |
|---|---|---|
id | string | The message tracking ID returned by the send endpoint |
reference | string | Caller-supplied reference, or an empty string if none was supplied |
to | string | Destination phone number |
status | string | DELIVERED |
parts | integer | SMS segment count recorded on the tracking record |
charge | string | Recorded monetary charge as a decimal string |
failure_reason | string | Included even when empty; normally empty for successful delivery |
timestamp | string | Delivery event timestamp, formatted as UTC RFC3339 |
transactional_sms.failed
Fired when a transactional SMS fails, including a failed delivery receipt or a final preparation or transport failure.
Payload:
{
"id": "69b27e24be03b743d4b9b7b3",
"reference": "lead-123",
"to": "+14155552671",
"status": "FAILED",
"parts": 1,
"charge": "0.01250",
"failure_reason": "Twilio status: failed, ErrorCode: 30004",
"timestamp": "2026-03-12T08:49:40Z"
}
| Field | Type | Description |
|---|---|---|
id | string | The message tracking ID returned by the send endpoint |
reference | string | Caller-supplied reference, or an empty string if none was supplied |
to | string | Destination phone number |
status | string | FAILED |
parts | integer | SMS segment count recorded on the tracking record |
charge | string | Recorded monetary charge as a decimal string; not a refund confirmation |
failure_reason | string | The recorded provider or sending failure reason |
timestamp | string | Failure event timestamp, formatted as UTC RFC3339 |
All eight payload fields are included in both events. These are delivery notifications, not verification-code validation: your CRM must generate and verify codes itself.
Forms
form.submitted
Fired when a contact submits a form.
Payload:
{
"form": {
"id": 1,
"name": "Newsletter Signup"
},
"contact": { ... },
"ip_address": "1.1.1.1",
"country": "AU",
"asn": "AS7545",
"is_proxy": false
}
| Field | Type | Description |
|---|---|---|
form | object | The form that was submitted, with id and name |
contact | object | Contact Object of the created or updated contact |
ip_address | string | The IP address of the visitor |
country | string | Two-letter country code based on IP geolocation |
asn | string | Autonomous System Number of the visitor's network |
is_proxy | boolean | Whether the visitor is using a VPN or proxy |
Best Practices
Security:
- Always verify the
X-Webhook-Signatureheader before processing any payload - Use constant-time comparison functions to prevent timing attacks
- Keep your webhook secret secure
Performance:
- Respond with a
200status code immediately upon receipt - Process webhook data asynchronously if your logic takes more than a few seconds
- Your endpoint must respond within 10 seconds to avoid timeouts
Reliability:
- Handle duplicates — in rare cases, the same event may be delivered more than once. Use the
idfield to deduplicate - Implement idempotent processing to safely handle duplicate deliveries
- Monitor failures — if your endpoint consistently fails, deliveries will be discarded after 8 attempts
- Use Webhook.site for debugging and inspecting webhook payloads during development
- A single action may trigger multiple events (e.g. updating a contact and adding a tag manually fires both
contact.updatedandcontact.tagged)