Skip to content

Webhooks

Webhooks let you receive real-time HTTP notifications whenever consent events occur in your eConsent properties. Instead of polling the API, your server is notified immediately when a certificate is created, consent is revoked, or other key events fire.

Webhook Management

Subscribe to any combination of the following event types:

EventDescription
session.certificate.createdA new consent certificate was generated
meta.certificate.createdA Meta (Facebook) lead certificate was generated
session.createdA new tracking session was initialized
consent.grantedA user granted consent on a tracked form
consent.revokedA previously granted consent was revoked
high_risk.detectedA session was flagged as high-risk
  1. Navigate to Channels > Webhooks in your dashboard at app.econsent.org.
  2. Click Add Endpoint.
  3. Configure the endpoint:
    • URL: The HTTPS endpoint that will receive webhook payloads. Must be a publicly accessible URL (localhost and private addresses are rejected).
    • HTTP Method: Choose POST, PUT, PATCH, or GET. Defaults to POST.
    • Events: Select which event types this endpoint should receive. If none are selected, the endpoint receives all events.
  4. Click Save. A unique signing secret is generated and displayed once. Copy it immediately.

Every webhook delivery sends a JSON payload with this structure:

{
"event": "session.certificate.created",
"timestamp": "2026-04-02T14:30:00.000Z",
"data": {
"certificateId": "cert-abc123",
"sessionId": "sess-xyz789",
"propertyId": "prop-456",
"consumerPhone": "+15551234567",
"consumerName": "Jane Doe",
"consentText": "I agree to be contacted...",
"ipAddress": "203.0.113.42",
"userAgent": "Mozilla/5.0..."
}
}

The data object contents vary by event type. Certificate events include the full certificate record; session events include session metadata.

Every webhook delivery is signed so you can verify it originated from eConsent. Three headers are included with each request:

HeaderDescription
X-EConsent-SignatureHMAC-SHA256 hex digest of {timestamp}.{body}
X-EConsent-TimestampUnix timestamp (milliseconds) when the payload was signed
X-EConsent-EventThe event type (e.g. session.certificate.created)

To verify, reconstruct the signed content by concatenating the timestamp, a period, and the raw request body. Then compute the HMAC-SHA256 using your endpoint’s signing secret and compare it to the X-EConsent-Signature header.

const crypto = require('crypto');
function verifyWebhookSignature(req, secret) {
const signature = req.headers['x-econsent-signature'];
const timestamp = req.headers['x-econsent-timestamp'];
const body = JSON.stringify(req.body);
const expected = crypto
.createHmac('sha256', secret)
.update(`${timestamp}.${body}`)
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature, 'hex'),
Buffer.from(expected, 'hex')
);
}

Field mapping lets you transform the default eConsent payload into the format your CRM or downstream system expects. This is configured per endpoint when creating or editing a webhook.

Map eConsent fields to custom field names using dot-path notation for the source:

Source (eConsent field)Target (your field name)
data.consumerPhonephone_number
data.consumerNamefull_name
data.certificateIdcert_id

With these mappings, instead of receiving the full default payload, your endpoint receives:

{
"phone_number": "+15551234567",
"full_name": "Jane Doe",
"cert_id": "cert-abc123"
}

Add fixed key-value pairs to every payload. Useful for identifying the source system or routing within your CRM:

KeyValue
sourceeconsent
campaign_idsummer-2026

Enable the Include Raw Payload option to append the original, untransformed payload under a _raw key alongside your mapped fields.

Webhook delivery uses a fire-and-forget model with retries for network-level failures only:

  • Attempts: 3 total (1 initial + 2 retries)
  • Backoff: Exponential starting at 10 seconds (10s, 20s, 40s)
  • Retry triggers: DNS failures, connection refused, and request timeouts (5-second timeout per attempt)
  • Non-retry cases: Any HTTP response (including 4xx and 5xx) is treated as a successful delivery. Only network errors trigger retries.

Use the Test button next to any configured webhook endpoint in the dashboard to send a test ping. This enqueues a test.ping event with the following payload:

{
"event": "test.ping",
"timestamp": "2026-04-02T14:30:00.000Z",
"data": {
"message": "This is a test webhook from eConsent"
}
}

The test payload is signed with your endpoint’s secret, so you can use it to verify your signature validation logic before going live.