Skip to Content
    Qafka
    CTRL K
    CTRL K
    • Introduction
      • Quick Start (React Native)
      • Quick Start (Website)
      • React Native Configuration
      • Overview
      • npm & React
      • Options Reference
      • WordPress
      • React Native Widget
      • Headless SDK
      • Theming
      • Context
      • Navigation
      • External Navigation
      • Handling Tools
      • Voice Chat
      • Sub-Projects
      • Error Handling
      • CLI
      • Dashboard
      • Onboarding
      • Invitations
      • Billing
      • Usage
      • Settings
      • Sign-in & Account
      • Dashboard Assistant
        • Project
        • Overview
        • Conversations
        • Chat Test
        • Sub-Projects
        • Analysis
        • Unanswered Questions
        • Insights
        • Configuration
        • AI Behavior
        • Members
        • Documents
          • Overview
          • Create with AI
          • Versions
          • Response Channel
        • Action Logs
        • Navigation Rules
        • External Destinations
        • Chat Theme
        • PII Masking
        • Websites
        • Mobile Apps
        • API Keys
        • Project Settings
      • API Key Security
    • Introduction
      • Quick Start (React Native)
      • Quick Start (Website)
      • React Native Configuration
      • Overview
      • npm & React
      • Options Reference
      • WordPress
      • React Native Widget
      • Headless SDK
      • Theming
      • Context
      • Navigation
      • External Navigation
      • Handling Tools
      • Voice Chat
      • Sub-Projects
      • Error Handling
      • CLI
      • Dashboard
      • Onboarding
      • Invitations
      • Billing
      • Usage
      • Settings
      • Sign-in & Account
      • Dashboard Assistant
        • Project
        • Overview
        • Conversations
        • Chat Test
        • Sub-Projects
        • Analysis
        • Unanswered Questions
        • Insights
        • Configuration
        • AI Behavior
        • Members
        • Documents
          • Overview
          • Create with AI
          • Versions
          • Response Channel
        • Action Logs
        • Navigation Rules
        • External Destinations
        • Chat Theme
        • PII Masking
        • Websites
        • Mobile Apps
        • API Keys
        • Project Settings
      • API Key Security

    On This Page

    • Which one do I use?
    • CDN snippet
    • Allowed domains
    • Content Security Policy
    • npm package
    • Visitor identity & tools on web
    • Media cards
    • Voice
    • Opening mode
    • Making room for the side panel
    • Agent cursor
    • WordPress
    Question? Give us feedback Edit this page 
    Web SDKOverview

    Web SDK Overview

    The Web SDK puts the Qafka assistant on a website or web app. It ships two ways:

    • CDN snippet — a single <script> tag. No build step, no install — works on any site, including WordPress via the dedicated plugin.
    • npm package (@qafka/web) — a framework-agnostic createQafka() bootstrap plus a React component, for apps that already have a build pipeline and want programmatic control (callbacks, a visitor grouping id, dynamic context).

    @qafka/web isn’t on the public npm registry yet — contact Qafka for access. The CDN snippet works without it.

    Both distributions are built from the same engine and render the same chat UI, voice mode, and in-chat media cards.

    The CDN widget open on a website, answering with results from a tool

    Which one do I use?

    CDN snippetnpm package
    SetupPaste a script tagnpm install @qafka/web
    Best forPublic marketing/content sitesWeb apps with signed-in users, custom logic
    Group messages by visitorNot supportedendUserId, endUserData
    Programmatic controlNonesendMessage, open, close, openVoice, update, callbacks
    WhereDashboard’s website onboarding, or Quick Start (Website)npm & React

    CDN snippet

    <script src="https://cdn.qafka.com/v1/qafka.js" data-key="qafka_pk_..." async></script>
    AttributeRequiredDescription
    data-keyYesYour project’s Web (publishable) key. Without it the loader no-ops.
    data-api-urlNoOverrides the backend URL. Defaults to https://api.qafka.com.
    data-langNoForces the widget’s UI language (tr or en). Omit to auto-detect from the visitor’s browser.
    data-open-modeNoForces how the chat opens on this site: panel or popup. Omit to follow the project’s Chat Theme setting — see Opening mode below.
    data-agent-cursorNoOpt-in agent cursor for navigation — see Agent Cursor below. A bare attribute or ="true" turns it on.

    Get the exact tag, with your key filled in, from your project’s dashboard: Onboarding (for a new site) or API Keys (anytime after).

    Allowed domains

    A chat session only starts from an origin that’s on both the project’s registered Websites and, if the key restricts itself to specific sites, one of those — any other page embedding the key gets rejected. A key’s own restriction can only narrow what Websites allows; it never allows a site on its own.

    Adding a site through the website onboarding flow registers its domain automatically as the project’s own site, and the Web key it creates is restricted to that domain. For any other domain the widget needs to run on (a staging environment, localhost during development, a second site), register the domain on the Websites page, then create a separate Web key for it on the API Keys page (the number of keys per project depends on your plan) — leave that key’s website restriction empty to let it work on any of the project’s registered websites.

    Enter the full origin, including scheme and port, for anything that isn’t a plain https://host — for example http://localhost:3000, not just localhost. A bare host is assumed to be https://, and scheme/port must match exactly.

    How many distinct site domains your account can register depends on your plan.

    To embed the widget on someone else’s site instead — a partner or publisher site outside your own domain — add it as a partner entry on the dashboard’s Websites page and use a Web key whose website restriction is empty or includes that site.

    See API Key Security for the full origin-allowlisting model.

    Content Security Policy

    If your site sends a Content-Security-Policy header, it has to allow the widget’s own sources. Without them the chat button may still appear, but no conversation starts.

    DirectiveSourceWhat it’s for
    script-srchttps://cdn.qafka.comThe loader and the chat panel.
    connect-srchttps://api.qafka.comChat requests. Use your own URL here if you set data-api-url / apiUrl.
    frame-srchttps://cdn.qafka.comThe invisible bot check that runs once before the first message.

    Also allow https://challenges.cloudflare.com in both script-src and frame-src. Widget versions up to 0.8.x run the bot check directly on your page and need it, and newer versions keep that path as a fallback.

    The bot check runs in a hidden 1×1 frame served from cdn.qafka.com. It shows nothing to your visitors, and you don’t have to register your domain anywhere beyond Websites. If the frame is blocked, the browser console shows a [qafka] warning that names frame-src.

    npm package

    npm install @qafka/web
    import { createQafka } from '@qafka/web' const qafka = createQafka({ publishableKey: 'qafka_pk_...', mode: 'floating', })

    A React component is also available at @qafka/web/react. See npm & React for the full setup, and Options Reference for every option.

    Visitor identity & tools on web

    Every web session — CDN snippet or npm package alike — is minted at the anonymous trust tier server-side. Passing isAuthenticated doesn’t change that: there is no identified web trust tier yet, so it’s used only for navigation screen filtering, not for tool access. Passing endUserId (and optionally endUserData) attaches a client-supplied grouping id to the conversation — useful for tying messages to a known user in your own app — but it isn’t a verified identity and doesn’t change what the assistant can do.

    This matters for tools: a tool is available on a web session only if its Platform includes Web and its Web access is set to “Open on web (incl. anonymous)” in the dashboard’s tool editor — the default, “Closed on web — native/api-key only”, hides the tool from every web session regardless of platform. Choose the Web access setting carefully for any side-effecting tool (email, webhook, writes) — opening it up exposes that action to anonymous visitors, including bots.

    Media cards

    When the assistant suggests a video, social post, or document link (embed/document destinations), the web widget renders it as an in-chat media card — a title, description, optional image, a play button for embeds, and a link to the original. See External Navigation › Media Destinations for the full destination-type reference.

    Voice

    Both distributions support voice mode. On the web, an in-call tool can also request a file upload from the visitor — a capability the React Native SDK’s voice mode doesn’t have. See Voice for setup, quotas, and platform differences.

    Opening mode

    The floating widget opens in one of two modes:

    • Side panel (default) — docks to the right edge and pushes the page aside, like a browser side panel. 360px wide by default; the visitor can drag it between 340px and 640px.
    • Popup — floats over the page’s bottom corner without moving it.

    Which one a visitor gets is resolved once, when the widget mounts:

    1. Your code: data-open-mode on the snippet, or openMode in createQafka().
    2. Otherwise the project’s Opening mode setting in the dashboard’s Chat Theme.
    3. Otherwise the visitor’s own last choice (the widget header has a switch button).
    4. Otherwise side panel.

    When your code or the project setting forces a mode, the visitor’s switch button is hidden.

    On narrow screens (under 768px) the side panel opens full-screen instead of docking. On wider screens it only pushes the page while at least 720px of page width remains; below that it overlays the page without pushing it.

    Making room for the side panel

    The widget pushes the page by setting margin-right on <body>. Elements that don’t follow the body’s width — position: fixed headers, cookie banners, floating cart buttons, 100vw sections — stay where they are and end up under the panel. While the page is being pushed, <html> carries two hooks you can style against:

    • data-qafka-panel="open"
    • --qafka-panel-width — the panel’s current width, e.g. 360px
    html[data-qafka-panel="open"] .site-header, html[data-qafka-panel="open"] .cookie-banner { right: var(--qafka-panel-width); } html[data-qafka-panel="open"] .full-bleed { width: calc(100vw - var(--qafka-panel-width)); }

    Both are removed as soon as the page is no longer pushed (popup, full-screen, overlay, or closed), and the body’s own inline margin-right is put back as it was before the panel opened.

    Two things to know:

    • A stylesheet rule that sets the body’s margin-right with !important wins over the widget’s inline margin, so the page isn’t pushed and the panel covers it. Remove the !important, or force popup mode on that site.
    • If your own scripts change the body’s inline margin-right while the panel is open, that change is lost when the panel closes.

    If your layout can’t make room — for example sections sized in JavaScript to the viewport width — force popup with data-open-mode="popup".

    Agent cursor

    An opt-in feature (agentCursor / data-agent-cursor, off by default): when the assistant navigates the visitor to another page, a visible cursor glides to one of the page’s own links for that destination and clicks it, instead of jumping directly. If no such link can be clicked safely, it falls back to navigating normally. Pressing Esc cancels a run in progress. When the visitor’s OS requests reduced motion, the glide itself is skipped — the link is still clicked, just without the animated cursor.

    WordPress

    Running WordPress? Use the WordPress plugin instead of hand-editing the snippet — it adds the script tag for you from a settings page.

    Last updated on November 21, 2026
    React Native Configurationnpm & React

    © 2026 Qafka Labs OÜ