In-app AI support SDK

Embed the OctaDezx AI support messenger with a script tag, @octadezx/messenger with React bindings, or React Native with push token registration. Native iOS and Android on the roadmap.

Status: available (v0.1). The OctaDezx messenger SDKs embed the hosted AI support chat in a website or app. The script tag works on any site today. The @octadezx/messenger package adds boot, show, hide, user attributes, events and unread counts with React bindings, and @octadezx/messenger-react-native shows the same chat in a WebView modal with push token registration. Both packages are published on npm at version 0.1.0 under the MIT license. Native iOS (Swift) and Android (Kotlin) SDKs are on the roadmap with the same surface.

Script tag (available)

Optional attributes: data-position (right or left), data-color, data-greeting, data-face, data-open, data-hide-launcher and data-locale.

HTML

<script src="https://octadezx.com/widget.js" data-business-id="YOUR-BUSINESS-ID" async></script>

Web package: @octadezx/messenger (available (v0.1))

Builds ship as ESM with types and as UMD. On the server every method is a no-op, so it is safe in SSR frameworks.

MethodNotes
boot(options)Loads widget.js once and mounts the messenger. Calling again with a new user re-identifies.
shutdown()Removes the messenger and resets the chat frame. Call on sign out.
show() / hide()Calls made before boot resolves are queued.
showNewMessage(text?)Opens with the composer pre-filled.
update(attributes)Flat object, max 50 keys; null deletes a key. Verified users only.
trackEvent(name, metadata?)Verified users only.
onUnreadCountChange, onShow, onHide, onIdentityEach returns an unsubscribe function.

TypeScript

import OctaDezx from "@octadezx/messenger";

await OctaDezx.boot({
  businessId: "YOUR-BUSINESS-ID",
  user: { name: currentUser.name, attributes: { plan: "pro" } },
  userJwt: await getOctadezxToken(), // signed on your server
  refreshToken: getOctadezxToken,    // called a minute before it expires
  locale: "en",
});

OctaDezx.show();
OctaDezx.showNewMessage("I have a question about order 1001");
OctaDezx.update({ plan: "enterprise", seats: 12 });
OctaDezx.trackEvent("checkout.started", { items: 3 });
const off = OctaDezx.onUnreadCountChange((n) => setBadge(n));

// on sign out
OctaDezx.shutdown();

React bindings (available (v0.1))

TSX

import { OctaDezxProvider, useOctaDezx } from "@octadezx/messenger/react";

export function App() {
  const { user, octadezxToken, refreshOctadezxToken } = useSession();
  return (
    <OctaDezxProvider businessId="YOUR-BUSINESS-ID" user={user && { name: user.name }} userJwt={octadezxToken} refreshToken={refreshOctadezxToken}>
      <Routes />
    </OctaDezxProvider>
  );
}

function HelpButton() {
  const { show, unreadCount } = useOctaDezx();
  return <button onClick={show}>Help {unreadCount > 0 && `(${unreadCount})`}</button>;
}

React Native (available (v0.1))

A full-screen modal backed by react-native-webview. Peer dependencies: react 18 or newer, react-native 0.72 or newer, react-native-webview 13 or newer. Push registration needs a verified user; registrations are stored now, and sending pushes for new replies is not built yet.

TSX

import { OctaDezxMessenger, OctaDezx } from "@octadezx/messenger-react-native";

export default function App() {
  return (<><Navigation /><OctaDezxMessenger /></>);
}

const { verified } = await OctaDezx.boot({
  businessId: "YOUR-BUSINESS-ID",
  user: { name: user.name },
  userJwt: await api.getOctadezxToken(),      // signed on your server, never in the app
  refreshToken: () => api.getOctadezxToken(), // called a minute before it expires
});

await OctaDezx.registerPushToken(token, Platform.OS === "ios" ? "ios" : "android", { provider: "fcm", appId: "com.yourapp" });

Native iOS and Android (roadmap)

Not built yet. The planned Swift Package (iOS 15+) and Kotlin library (minSdk 24) mirror the web and React Native API: boot, present or show, showNewMessage, update, trackEvent, unread count, push token registration and shutdown, hosting the same chat page. Push sending for new replies is planned server work; signed, expiring user tokens already work.

Planned Swift surface

@MainActor public final class OctaDezx {
    public static let shared: OctaDezx
    @discardableResult public func boot(_ options: BootOptions) async throws -> IdentityResult
    public func present(from: UIViewController? = nil)
    public func showNewMessage(_ text: String = "")
    public func registerDeviceToken(_ token: Data) async throws
    public func shutdown()
}

Install

@octadezx/messenger (available, v0.1.0, MIT license)

Web messenger SDK, with React bindings at @octadezx/messenger/react.

npm install @octadezx/messenger

@octadezx/messenger on npm

@octadezx/messenger-react-native (available, v0.1.0, MIT license)

React Native messenger backed by react-native-webview, with push token registration.

npm install @octadezx/messenger-react-native react-native-webview

Peer dependencies: react, react-native and react-native-webview. On iOS, run pod install after installing.

@octadezx/messenger-react-native on npm

Questions or a larger rollout? Contact us (kevin@octadezx.com).

Frequently asked questions

Keep reading

OctaDezx home · Pricing · Blog · Start free trial