The Developer API Guide: Deep Embedding & Identity Sync
Developer Docs Feb 22, 2026 12 min read

The Developer API Guide: Deep Embedding & Identity Sync

Dexra Engineering

Author

The Developer API Guide: Deep Embedding & Identity Sync

For developers, Dexra is a programmable API-first platform. To move beyond a basic chat widget, you must utilize our Backend and Frontend SDKs to create a seamless user experience.

1. Zero-Friction Identity Sync (SBUser)

When a user is logged into your app, they should never have to type their name or email into the chat widget. Use the SBUser class to sync their session.

document.addEventListener("SBInit", function () {
  // Initialize the user with custom attributes from your DB
  const user = new SBUser({
    first_name: "Amine",
    email: "amine@example.ma",
    user_type: "premium" // This can trigger specific AI behaviors
  }, {
    subscription_expiry: "2026-12-31",
    account_manager: "Sarah"
  });
  
  user.update(); // Pushes data to the Dexra Integration Layer
});

2. Event-Driven Logic via Webhooks

Your application needs to respond in real-time to conversation states. Dexra’s Webhook Engine acts as the bridge between our AI Layer and your backend, pushing JSON payloads to your server as events occur.

Key Implementation Patterns:

  • message_in: Use this to mirror chat logs into your internal CRM. It includes the conversation_id, message_text, and source_channel (e.g., WhatsApp, Telegram).
  • conversation_created: Trigger internal high-priority alerts. If a user with a customer_lifetime_value > 5000 starts a session, your webhook handler can ping a “High Value Lead” channel in Slack.
  • user_updated: Synchronize marketing tags. When Dexra’s AI detects a specific intent or a user completes a flow, it updates the user profile; use this event to sync tags like “Hot Lead” or “Trial Expired” to your marketing automation tools.

[Image of Webhook sequence diagram showing Dexra payload delivery to developer server]

3. Server-to-Server Web API

For transactional or system-generated messaging, utilize the Dexra REST Web API. This allows your backend logic to initiate outbound communication across any supported channel using a single authenticated endpoint.

Technical Specification:

  • Base Endpoint: https://api.dexra.net/v1/send-message
  • Authentication: Authorization: Bearer <YOUR_API_KEY>
  • Payload Support: Full support for JSON bodies including:
    • recipient_id: Phone number (for WhatsApp/SMS) or User ID.
    • message_type: text, media, button, or template.
    • channel: Specify whatsapp, email, telegram, etc.

Example Use Case: Automating a “Password Reset” or “Security Alert.” When your system detects a login from a new IP, use the Web API to send an instant verification link via WhatsApp—the channel with a 98% open rate.

[Image of Dexra Web API request and response JSON structure]

Pro Tip: The Sandbox Mode for Safe Deployment

Never test in production. Dexra provides a dedicated Development Environment (Sandbox Mode) accessible via your dashboard. Isolate your data, ensure idempotency checks on webhook handlers, and log incoming payloads to verify signatures.

👉 Access the Full API Reference and Start Building Your Custom Layer.

Developer First

Build AI Features
In Minutes.

Our SDK is designed for developers who hate boilerplate. Drop in our React components and get instant AI chat, search, and analytics.

bash — 80x24
$npm install @dexra/sdk

added 1 package, and audited 2 packages in 1s

found 0 vulnerabilities

$

Ready to automate your support?

Join 500+ companies using Dexra to reduce churn and answer tickets instantly.

Share this article:
Back to all articles