Beginner Visitor SDK Guide

Add Ringnity to a website

This page shows what your customer will see, which install method to choose, and how each Visitor SDK method is used in a real page.

For the complete method table, option list, events, errors, and cURL checks, open API Reference.

client-website.com
Support

Ringnity Support

Online now

Hi, how can we help today?
I need help with my order.
Sure. An agent will join shortly.
Type a message...

Visual walkthrough

1

Load SDK

Add the script tag or import the NPM package.

2

Create client

Use slug your-tenant-slug and optional visitor data.

3

User clicks

A button calls openChat, openVoice, or openVideo.

4

Support opens

Ringnity creates a session and opens the support window.

Choose the install style

Script tag

Plain HTML, WordPress, Shopify theme, or a site without a frontend build step.

Fastest install. Ringnity can show its default launcher automatically.

NPM

React, Next.js, Vue, Nuxt, or another app that uses npm packages.

Best for apps that already have components and state management.

Headless controls

You want your own buttons, menus, CRM sidebar, or custom support flow.

Most flexible. Ringnity prepares the runtime, your UI decides what opens.

1. Script tag: default launcher

Use this when you want Ringnity to show the default floating support button. Visitor SDK loads the tenant config, checks allowed domain, and renders the launcher.

<script src="https://api.ringnity.com/sdk/ringnity.js"></script>
<script>
  Ringnity.init({
    slug: 'your-tenant-slug',
    visitor: {
      name: 'Website Visitor'
    },
    managedUi: {
      defaultService: 'chat',
      launcherText: 'Support',
      launcherLabel: 'Open Ringnity support',
      position: 'bottom-right',
      closeOnEscape: true
    },
    onStatusChange: function (status) {
      console.log('Ringnity status:', status);
    },
    onReady: function () {
      console.log('Ringnity is ready');
    },
    onError: function (error) {
      console.warn(error.code, error.message);
    }
  });
</script>

Universal widget and direct link

Use the universal script for simple copy-paste floating widgets. It renders the button/popup and loads the visitor app directly. New advanced integrations should use the modern Visitor SDK snippet above.

Universal widget script

<script src="https://api.ringnity.com/widget/widget.js?apiKey=PUBLIC_WIDGET_KEY"></script>

Direct visitor link

https://visitor.ringnity.com/?apiKey=PUBLIC_WIDGET_KEY

2. NPM: app framework usage

Use this in React, Next.js, Vue, or any frontend app with a build step. The Visitor SDK methods are the same as script tag; only the loading style changes.

import { Ringnity } from '@ringnity/web-sdk';

const ringnity = await Ringnity.create({
  slug: 'your-tenant-slug',
  visitor: {
    externalId: 'customer-123',
    name: 'Aira Kirana'
  },
  managedUi: {
    showLauncher: false,
    closeOnEscape: true
  }
});

document.querySelector('#chatButton')?.addEventListener('click', () => {
  void ringnity.openChat();
});

await ringnity.devices.registerPushToken({
  platform: 'web',
  provider: 'fcm',
  token: webPushToken,
  audience: 'customer',
  externalId: 'customer-123'
});

3. Headless controls: custom buttons

Headless means Ringnity prepares the visitor runtime but does not decide your UI. You can place your own Chat, Voice, and Video buttons anywhere.

<button id="chat">Chat with us</button>
<button id="voice">Start voice call</button>
<button id="video">Start video call</button>

<script src="https://api.ringnity.com/sdk/ringnity.js"></script>
<script>
  async function setupRingnity() {
    const ringnity = await Ringnity.create({
      slug: 'your-tenant-slug',
      visitor: {
        externalId: 'crm-customer-123',
        name: 'Aira Kirana',
        email: 'aira@example.com'
      },
      metadata: {
        source: 'pricing-page'
      }
    });

    document.querySelector('#chat').onclick = function () {
      ringnity.openChat();
    };

    document.querySelector('#voice').onclick = function () {
      ringnity.openVoice();
    };

    document.querySelector('#video').onclick = function () {
      ringnity.openVideo();
    };
  }

  setupRingnity();
</script>

4. CRM panel mounting

Use this style when Ringnity should live inside a CRM sidebar instead of a floating launcher. The customer app controls where the support window appears.

<aside id="support-panel"></aside>

<script type="module">
  import { Ringnity } from '@ringnity/web-sdk';

  const ringnity = await Ringnity.create({
    slug: 'your-tenant-slug',
    tokenProvider: fetchRingnityRuntimeToken,
    managedUi: {
      showLauncher: false,
      defaultService: 'chat',
      container: '#support-panel'
    }
  });

  ringnity.mount('#support-panel');
  await ringnity.openChat();

  // When the CRM tab closes:
  ringnity.unmount();
</script>

Command cheat sheet

openChat()

Open the chat support window.

chatButton.onclick = () => ringnity.openChat();
chat.createConversation()

Create a headless support conversation for your own UI.

const conversation = await ringnity.chat.createConversation({ subject: 'Need help' });
chat.sendMessage()

Send a visitor message from your custom chat screen.

await ringnity.chat.sendMessage({ conversationId, body: 'Hi' });
ai.streamChat()

Receive AI response events through callbacks.

await ringnity.ai.streamChat({ message }, { onDelta: event => append(event.data.delta) });
calls.createSession()

Create an audio or video call session for custom flows.

const call = await ringnity.calls.createSession({ conversationId, type: 'audio' });
devices.registerPushToken()

Register an optional browser or mobile push token for runtime notifications.

await ringnity.devices.registerPushToken({ platform: 'web', token: webPushToken });
openVoice()

Open the voice call support window.

voiceButton.onclick = () => ringnity.openVoice();
openVideo()

Open the video call support window.

videoButton.onclick = () => ringnity.openVideo();
mount(target)

Render the managed support window inside a CRM panel or page element.

ringnity.mount('#support-panel');
unmount()

Remove the managed support window from the mounted element.

ringnity.unmount();
close()

Close the support window, but keep the SDK ready.

closeButton.onclick = () => ringnity.close();
refresh()

Reload tenant settings after admin changes services or domains.

await ringnity.refresh();
destroy()

Remove the SDK instance from the page when it is no longer needed.

ringnity.destroy();

5. Object model: custom chat and AI

Use this style when the customer has a CRM sidebar, member portal, or custom chat screen. Ringnity handles session, entitlement, and service checks; your UI renders the messages.

const ringnity = await Ringnity.create({
  slug: 'your-tenant-slug',
  visitor: {
    externalId: 'customer-123',
    name: 'Aira Kirana'
  }
});

const conversation = await ringnity.chat.createConversation({
  subject: 'Need help with my order'
});
const conversationId = conversation.conversationId;

ringnity.chat.onMessage((message) => {
  renderMessage(message);
});

await ringnity.chat.sendMessage({
  conversationId,
  body: 'Hi, I need help.'
});

await ringnity.ai.streamChat(
  {
    conversationId,
    message: 'Summarize this issue for the agent.'
  },
  {
    onDelta: (event) => appendAiText(event.data.delta),
    onDone: (event) => saveAiAnswer(event.data.message),
    onError: (event) => showError(event.data.message)
  }
);

const call = await ringnity.calls.createSession({
  conversationId,
  type: 'audio'
});

How to know it works

When the integration is correct, Visitor SDK reaches onReady. When a visitor clicks Chat, the event order usually looks like this:

onReady
onServiceSelected chat
onOpen chat

Origin check

If Visitor SDK works in the dashboard but not on the client website, check whether the website domain is saved in Dashboard > Developer > Visitor SDK.

curl -H "Origin: https://client-domain.com" \
  "https://api.ringnity.com/api/sdk/bootstrap?slug=your-tenant-slug&debug=true"