Skip to main content

Architecture

The Hacktionbase widget is an iframe embedded in your page by the SDK. It communicates with the SDK via the browser’s postMessage API.
┌──────────────────────────────────┐
│         Your Website             │
│                                  │
│   ┌────────────────────────┐     │
│   │   Hacktionbase SDK     │     │
│   │   (bubble + listeners) │     │
│   └──────────┬─────────────┘     │
│              │ postMessage        │
│   ┌──────────▼─────────────┐     │
│   │   Widget iframe        │     │
│   │   ({tenant}.hacktionbase.com) │
│   │   - Conversations      │     │
│   │   - In-app messages    │     │
│   └────────────────────────┘     │
└──────────────────────────────────┘

Components

The widget consists of two visible elements:
  1. Bubble — a floating button in the corner of the page. Clicking it toggles the panel open/closed.
  2. Panel — the iframe containing the widget UI (conversations, messages).

Lifecycle

  1. Hacktionbase.init() fetches the widget configuration from the API
  2. The SDK injects CSS, creates the bubble, and creates a hidden iframe
  3. When the iframe loads, it sends hacktionbase:ready
  4. The SDK responds with config and session context
  5. The widget authenticates via the widget auth endpoint and receives a JWT
  6. The user can now open the panel, view conversations, and receive in-app messages

PostMessage protocol

All messages between the SDK and widget use a hacktionbase: prefix:

SDK → Widget

MessageDescription
hacktionbase:widget_contextSession data (sessionId, anonymousId, userId, sdkKey, device info)
hacktionbase:configWidget appearance configuration
hacktionbase:identifyUser identification data

Widget → SDK

MessageDescription
hacktionbase:readyWidget iframe has loaded
hacktionbase:closeUser clicked close button in the widget
hacktionbase:widget_auth_successAuthentication complete (includes widget JWT)
hacktionbase:show_modalTrigger an in-app message modal in the host page
hacktionbase:resizeRequest panel height change
All postMessage communication is origin-verified. The SDK only accepts messages from your tenant’s widget origin ({tenant}.hacktionbase.com).