Skip to content

Docs / Getting started

Connect your CRM

Start calls from your CRM with a signed webhook per trigger, map your fields, and receive each call’s outcome, summary and transcript back.

How it connects

There are two directions:

  • Your CRM → Xaelin: a trigger per kind of call. Each has its own URL and secret. Your CRM posts a customer to it and a call is queued.
  • Xaelin → your CRM: one result webhook. When a call has ended and its summary is ready, Xaelin posts the result to your URL.

Admins set both up: triggers inside a call flow (Call flows → a flow → Triggers), the result webhook under Integrations.

Add a trigger

  1. Open the call flow the trigger should start and go to Triggers.
  2. Add a trigger. Copy its URL and secret.
  3. Map your fields. Out of the box Xaelin reads top-level phone, name, language, email, id and country. If your JSON is shaped differently, point each field at its place with a dot path such as client.phone.
  4. Paste a sample body into the test console to see what it becomes, without saving or calling.

Send from your CRM

Post any JSON object. Sign the raw body with the trigger’s secret:

http
POST https://app.xaelin.com/v1/hooks/trg_7Kq2mX
Content-Type: application/json
X-Signature: sha256=<hex HMAC-SHA256(secret, raw_body)>
json
{
  "client": {
    "id": "C-77",
    "phone": "+1 555 0142",
    "full_name": "Maya Lopez",
    "language": "es"
  },
  "account": { "type": "Gold" },
  "tags": ["vip", "new"]
}

CRMs that can’t sign can send the secret instead, as Authorization: Bearer <secret> or ?key=<secret>.

A Laravel example:

php
$body = json_encode([
    'id'       => $user->id,          // mapped to the contact's CRM ID
    'phone'    => $user->phone,       // international format, e.g. +15550142
    'name'     => $user->name,
    'language' => $user->locale,
    'account'  => ['type' => $account->type],   // any other field: use {{account.type}} in the flow
]);

Http::withHeaders([
    'X-Signature' => 'sha256=' . hash_hmac('sha256', $body, config('services.xaelin.trigger_secret')),
])->withBody($body, 'application/json')
  ->post('https://app.xaelin.com/v1/hooks/trg_7Kq2mX');

What happens to the body

  • The phone is cleaned up (spaces, dashes, a leading 00) and must be in international format. Its country, and the customer’s calling hours, come from the number.
  • The language accepts codes or names, like en or English. A flow set to the contact’s language uses it.
  • Every field you didn’t map is kept on the contact, flattened: account.type, and lists as text (tags becomes “vip, new”). A flow’s opening line and brief can use them as {{account.type}}, and the agent knows them as what you know about the customer. IDs, tokens and passwords are left out.
  • The contact is saved, or updated when the phone number already exists, and a call is queued after the flow’s delay. If that contact is already waiting for this flow, it keeps its one call.

Responses

Response When
202 {"job_id", "contact_id", "call_at"} Accepted and queued
401 Unknown trigger, bad signature or key
409 The trigger is paused, or the number is on your Do Not Call list
422 No usable phone, a body that isn’t a JSON object, or the flow was deleted

Receive results

Under Integrations, enter one webhook URL. When a call has finished and its summary is in, Xaelin posts call.completed:

http
POST <your URL>
Content-Type: application/json
X-Event: call.completed
X-Timestamp: 1764900000
X-Signature: sha256=<hex HMAC-SHA256(webhook_secret, timestamp + "." + raw_body)>
json
{
  "event": "call.completed",
  "sent_at": "2026-12-05T10:02:11Z",
  "call": {
    "id": "call_…",
    "to": "+15550142",
    "name": "Maya Lopez",
    "country": "US",
    "language": "es",
    "status": "completed",
    "outcome": "completed",
    "goal_met": true,
    "summary": "Welcomed; will upload her ID today.",
    "transferred_to": "",
    "cost_usd": 0.5,
    "created_at": "…", "answered_at": "…", "ended_at": "…",
    "talk_seconds": 118,
    "flow": "Welcome call", "flow_id": "flow_…",
    "contact_id": "ct_…",
    "external_id": "C-77",
    "do_not_call": false,
    "has_recording": true,
    "transcript": [
      { "at_ms": 0, "speaker": "agent", "text": "Hola Maya…" },
      { "at_ms": 2400, "speaker": "customer", "text": "¡Hola!" }
    ]
  }
}

outcome is one of completed, transferred, no_answer, busy, voicemail, opted_out or failed. external_id is your CRM’s ID from the trigger.

  • Check the signature, and reject requests older than 5 minutes. Answer with any 2xx.
  • No answer or a 5xx is retried 3 times; a 4xx isn’t retried.
  • Integrations shows the latest deliveries, and Send test posts a sample.
  • URLs that point at private or internal addresses are refused.

The API

For your own code, create an API key under Integrations and send it as a Bearer token. Keys are shown once; keep them on your server.

Endpoint
POST /v1/calls Call someone now
GET /v1/calls/{id} A call, its transcript and summary
POST /v1/flows/{id}/call Queue a call with a flow (calling hours apply)
POST /v1/contacts Add or update a contact
PUT /v1/contacts/{id}/dnc Do Not Call on or off
GET /v1/queue Calls waiting or in progress
bash
curl -X POST https://app.xaelin.com/v1/calls \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+15550142",
    "name": "Maya Lopez",
    "language": "en",
    "variables": { "call_brief": "Welcome her and explain the next step." }
  }'

Something unclear or out of date? Email support@xaelin.com.