Skip to content

raia Chat · Section

SDK & Embed Guide

JavaScript SDK and iframe integration.

There are two ways to put raia Chat on a page. The JavaScript SDK (window.raiaChat) gives you full programmatic control over when the widget loads, who the user is, and what happens on each event. The iframe is a one-line drop-in for static sites and CMS pages where you cannot run custom scripts.

In this section

  • Choose between the SDK and the iframe for a given surface.
  • Install the SDK snippet and open, close, and control the widget from your own code.
  • Pass authenticated user context securely with a signed token instead of query strings.
  • Handle widget events to fire analytics and to react to escalations.
01

What's inside

  1. 01

    Script embed (SDK)

    Add the snippet from Launch Pad → Launch just before the closing body tag. It loads asynchronously and exposes window.raiaChat once ready. Best for SPAs, authenticated apps, and anywhere you need control.

  2. 02

    Iframe embed

    Drop the iframe URL into any page or CMS block. No JavaScript API, no user context — the widget renders inside the frame with the settings from Live Chat Configuration.

  3. 03

    User context

    For authenticated experiences, sign the user identity server-side and hand the token to the SDK. Never trust identity passed from the browser alone.

  4. 04

    Events

    Subscribe to lifecycle events — widget opened, conversation started, message sent, escalation raised, conversation ended — and forward them to your analytics stack.

02

At a glance

CapabilitySDKIframe
Programmatic open/closeYes — raiaChat.open() / .close()No
Authenticated user contextYes, via signed tokenNo
Event callbacksYesNo
Prefill or send a messageYesNo
Route-aware behavior in an SPAYesNo
Setup effortOne snippet plus optional wiringOne line of HTML

Security

Both methods enforce the allowed origin list and the Security Key configured on the widget. Keep secret keys server-side — only the public key belongs in browser code.

03

Related