Webhooks — Incoming Triggers & Lead Capture

XSender exposes inbound HTTP webhooks so that any external system can push data into a workflow — your storefront, CRM, billing system, IoT device, Zapier, Make, or a custom backend. This is the primary way to "process incoming messages and events" inside XSender.

There is one canonical inbound endpoint and several specialised ones. Each is documented below with the request shape, what XSender does on receipt, and a copy-pasteable example.

When to use a webhook vs the Send API

You want to…Use
Send a single transactional messageSend API (/api/{channel}/send)
React to an event in your system (signup, order, support reply) by enrolling a contact into a workflowAutomation Trigger Webhook
Receive delivery events from your ESP (Mailgun open, SES bounce, …)Email Delivery Webhooks
Capture leads submitted on Meta / Google ad formsLead Capture Webhooks
Sync session state between the WhatsApp Node service and the appWhatsApp Session Webhook

Automation Trigger Webhook — POST /api/automation/webhook/{id}

This is the most powerful inbound endpoint. It lets any external system trigger an automation workflow in XSender by POSTing a JSON payload that identifies a contact (email, phone, or WhatsApp number) plus any custom fields you want available inside the workflow.

Step 1 — Create a Webhook trigger node in the workflow

In Automation → Workflows → New Workflow, drag the Webhook trigger onto the canvas. XSender generates a unique webhook_id for that node — copy the full URL.

Step 2 — POST to the webhook URL

curl -X POST https://YOUR-XSENDER-DOMAIN/api/automation/webhook/4f2c1b8d-9e6a-4f0b-bcde-1234567890ab \
  -H "Content-Type: application/json" \
  -d '{
    "email":      "[email protected]",
    "phone":      "+15555550123",
    "first_name": "John",
    "last_name":  "Doe",
    "order_id":   "A1023",
    "amount":     "129.95"
  }'

What happens on receipt

  1. XSender resolves the contact: existing contact with that email/phone is reused; otherwise a new contact is created.
  2. All keys in the payload are written as contact attributes, so subsequent workflow nodes can reference them with {{ order_id }}, {{ amount }}, etc.
  3. The contact is enrolled into every workflow whose Webhook trigger matches this webhook_id.
  4. The workflow runs (send email, send SMS, branch on conditions, wait, call another webhook, …).

Response

{
  "success": true,
  "message": "Webhook processed",
  "workflows_triggered": 2,
  "contacts_enrolled":   1
}

Common integrations

Authentication: the unguessable webhook_id in the URL acts as the secret. Treat it like an API key. Rotate it (delete + recreate the trigger node) if you suspect leakage.

Lead Capture Webhooks

Meta Lead Ads — POST /api/webhook/meta-lead-ads

Configured automatically when you connect a Meta page in Lead → Lead Generation → Meta. XSender:

Set this URL inside the Google Ads Lead Form Extension. XSender validates the Google-signed payload, maps fields, and creates contacts the same way.

Both endpoints are exempt from rate-limiting.

WhatsApp Session Webhooks

These are used internally by the bundled WhatsApp Node service (whatsapp-node-service) to keep the XSender database in sync with the live WhatsApp Web sessions. You normally don't call them directly, but they are documented here for self-hosted users who run their own node service.

MethodPathPurpose
POST/api/whatsapp/session/statusPush session state changes (connected / disconnected / qr).
POST/api/whatsapp/session/syncOn node startup, bulk-sync all sessions.
GET/api/whatsapp/session/status/{sessionId}Read the latest session status.
POST/api/whatsapp/node/webhookInbound message + status events from the node service.

Testing webhooks

  1. Use a tool such as curl, Postman, or webhook.site as a transparent proxy.
  2. From XSender, open the workflow and check the Workflow Executions tab — every webhook fire is logged with timestamp, payload, and the contact enrolment outcome.
  3. For Meta / Google, the platform console shows delivery attempts and any 4xx/5xx XSender returned.

Security checklist