OneInbox

Connecting the Website Widget No dashboard needed

The website widget is the odd one out among OneInbox's channels: there's no third-party developer account, no app review, and no dashboard to configure anywhere else — everything happens inside OneInbox's own admin panel, and the only thing you paste elsewhere is a single line of HTML on your own site.

In plain words

What this is. A chat bubble in the corner of your own website. Visitors click it and chat with your AI, without leaving your site and without installing anything.

The problem it solves. Many visitors have a quick question and leave if they cannot ask it. Not everyone wants to open WhatsApp or give a phone number. The widget lets them ask right there.

How it works. You paste one line of code into your website. That line loads the chat bubble. Messages go to the same Inbox as all your other channels.

How long it takes. About 5 minutes, if you can edit your website.

For what a channel is and how to manage one afterwards, see Channels.

1. Create the channel in OneInbox

  1. In OneInbox, go to Channels → Add channel.
  2. Choose Website widget, give it a name (e.g. "Website Chat").
  3. Optionally choose an assistant now, or do it later from the channel's card — no credentials are required, so this is the shortest of every channel's setup.
  4. Save.

2. Copy the embed snippet

On the new channel's page, OneInbox shows an embed snippet that looks like this:

<script src="https://yourdomain.com/widget.js" data-channel="wc_8f3kQ2..." async></script>

Paste it just before the closing </body> tag on every page of your site where you want the chat bubble to appear — a shared footer/layout template is the usual place if your site has one, so you only add it once.

  • data-channel is this channel's own key — copy it exactly as shown, don't reuse another channel's snippet.
  • The script is loaded with async and adds nothing to your page until it finishes loading, so it won't block your site's own rendering.
  • Widget language. The bubble's buttons show in each visitor's browser language. To fix one language instead, choose it under Widget language above the snippet; the snippet then gets a data-lang attribute (for example data-lang="es"). The AI always answers in the language the visitor writes in.

3. Test it

Open your site in a normal (or incognito) browser tab. A round chat launcher button appears in the bottom-right corner. Click it, send a message, and it should appear in OneInbox's Inbox within a few seconds and, if a knowledge base is linked, get an AI reply within about 5 seconds — the widget checks for new replies on a short poll, not instantly.

If nothing arrives within a minute, see Troubleshooting & FAQ.

Customize your chat

The chat can match your own website. Open the channel's page and choose Appearance on the left. Every change shows in the preview beside the settings straight away; press Save changes when you like it.

Icon. Upload a square picture, such as your logo (PNG, JPG or WEBP, at least 64 × 64 pixels and under 2 MB). It appears in the chat header and beside replies, and can also go on the chat button. Without one, the chat shows a speech bubble on your colour.

Chat theme

  • Color. The header, the chat button, the Send button and your visitor's own messages. Pick a ready-made colour or any colour of your own. On a light colour the text turns dark so it stays readable.
  • Color mode. Light, Dark, or follow the visitor's device (dark when their phone or computer is in dark mode).
  • Header title. Left empty, it says "Chat with us" in each visitor's own language.
  • Subtitle. The small line under the title. Left empty, it shows Online or Away.
  • Welcome message. The first message visitors see, before they write anything.

Avatars

  • Header avatars, at the top of the chat:
    • Last active team members. Up to three people from your team who used the app most recently.
    • Online team members only. Up to three people who used the app in the last 15 minutes. When nobody has, the chat shows your icon instead.
    • Your icon, or Hidden.
    • Selected team members. Pick up to three people yourself.
  • Avatars beside replies:
    • The team member who replied. A reply written by a person shows their photo (or their initial). Replies from the AI show your icon.
    • Your icon, or Hidden.

Visitors only ever see a team member's first name and profile photo. Each person adds their photo under Settings, Profile; without one, the chat shows their initial.

Chat button

  • Show your icon on the chat button instead of the speech bubble (upload an icon first).
  • Show online or away. A green dot when you are open, grey when you are away, based on the channel's business hours. When business hours are off, the chat always shows as online, because the assistant answers at any time.
  • Show the welcome message beside the closed chat button. A small note next to the button invites visitors to start. They can close it, and it stays closed until they open a new browser tab.
  • Play a sound when a reply arrives while the chat is closed. A short chime when you or the assistant answer and the visitor is not looking at the chat. It is on until you turn it off. Browsers only allow sound after the visitor has clicked or typed on the page, so on a freshly opened page the first reply may arrive silently.
  • Show the chat on the left of the page instead of the right.

Whatever the sound setting, a reply the visitor has not seen yet puts a red count on the closed chat button. The count follows them to your site's other pages and clears when they open the chat.

While the assistant writes an answer, the visitor sees three moving dots in the chat. If the channel is set to Save as a draft for review, no dots appear: the answer waits in the Inbox until a person sends it. Each message lines up by its own language: Arabic, Urdu or Hebrew reads from the right, English from the left, whatever language the visitor's browser uses.

Changes appear on your website the next time a page loads. You do not need to change or paste the embed snippet again: the chat reads these settings when it starts.

Ask visitors for their details

You can ask who is writing before the conversation starts. Open the channel's page and choose Visitor details on the left. Switch on Ask for visitor details and pick what to request: Name, Email and Phone, each Off, Optional or Required. At least one must be switched on. It is off by default, and it is available when your plan includes the pre-chat form.

When decides where the form appears:

  • Before the first message. As soon as a visitor opens the chat, the form takes the place of the message box. They press Start chat to continue.
  • After the first answer. The visitor sends their question and gets the assistant's first answer as usual. The form then appears in the chat and the message box stays locked until it is filled in or skipped.

If every field is Optional, the visitor can choose Skip. Add an Intro line to explain why you are asking, and a Privacy note with a link to your privacy policy if you have one. The words in the form follow the visitor's language.

A visitor is not asked again once they have given their details. If they already gave them to your site, or if they had a conversation with your chat before you switched the form on, the form is skipped. Details go onto the contact in the Inbox, beside the conversation.

This is different from a lead form. A lead form asks its questions when a person takes over the conversation; this form asks who the visitor is before or just after the assistant's first answer, so the assistant and your team know who they are from the start.

Quick actions in the chat header

On a desktop browser, the chat header has a ⋮ button in place of a close button. Hover over it or click it to open Quick actions:

  • Minimize chat closes the panel. The round chat button in the corner closes it too.
  • Expand view makes the panel larger; choose Collapse view to return to its normal size. Your choice is remembered on the site's other pages. On a phone, the chat already fills the screen, so the menu is hidden and the close button remains.
  • New conversation is available once the chat has messages. It asks you to confirm, then closes the current conversation in OneInbox with a note for your team saying the visitor started a new one. The visitor keeps their details and can send a new question straight away, which opens a fresh conversation. The old one stays closed in the Inbox. To keep the Inbox free of spam, a visitor can start only 3 new conversations an hour, and one network 10; after that the chat asks them to carry on in the current one.

Protect your chat from spam

The snippet is visible in your page's source, so anyone can copy it. To stop a copy from being misused, open the channel's page and use Protect your chat:

  • Allowed websites. Enter your website's domain, one per line (for example shop.com). The chat then only works on those websites and their subdomains (help.shop.com too). Entering www.shop.com counts as shop.com, so the site works with and without www. A copy of your snippet on someone else's site shows the bubble, but every message is refused. Leave the list empty to allow any website; the page warns you while it is empty. Add localhost if you also test on your own computer.
  • Make a new key. If someone is misusing your snippet anyway, make a new key. The old snippet stops working at once, everywhere, so paste the new one on your website straight away. Visitors start a new chat after the change.
  • Identity secret (optional). Only needed if your website has its own server. That server uses this secret to sign the email it passes to identify(), so nobody else can claim to be one of your customers. See Recognising a visitor across devices. If it leaks, choose Make a new secret and put the new one on your server; signatures made with the old one stop matching at once.

These work on their own, with nothing to set up:

  • Limits for new visitors. One network (IP address) can start only a few new chats per hour, and each chat takes only so many new visitors per hour. A visitor already chatting is never cut off. When a limit is reached, the bubble tells new visitors to try again later.
  • A quick check for new visitors. Your platform may ask a new visitor to pass a short check, usually invisible, before their first message. It keeps scripted spam out. A visitor already chatting is never asked again.
  • Blocking. In the Inbox, open the conversation's menu and choose Block contact, or use the same button on the person's contact page. Their new messages are ignored and the conversation is closed. On the website chat, new chats from the same network are refused too, which can include other people in the same office or on the same mobile network. Choose Unblock contact in the same place to undo it. Blocking works on every channel, and needs the permission to manage contacts.

Buttons in the chat

When an automation sends quick replies, a list or a link button, the chat shows them as buttons under the message. A visitor taps one and the chosen words are sent as their reply. A link button opens the page in a new tab.

How visitor sessions work

A visitor never logs in or signs up. The widget generates a random session ID the first time it loads and stores it in the browser's localStorage, then reuses that same ID on every later visit from the same browser — so a returning visitor sees their previous conversation continue, but a different browser or device always starts a brand-new one. Clearing site data or browsing in a private window also starts a new conversation, since there's nowhere for the session ID to persist.

Recognising a visitor across devices

Once OneInbox knows a visitor's email address, it saves it on their contact, so your team sees who they are. That works on any website, even a plain HTML one. Optionally, if your website has its own server, it can also sign that email, and OneInbox then joins up the visitor's conversations from different browsers and devices.

  • From a lead form. When a visitor answers an Email field in a lead form with a valid address, the email is saved on their contact. A typed answer is not proof of who someone is, so it never brings back conversations from another device.

  • From your own site. If your visitors log in to your website, you already know their email. After the embed snippet, call:

    window.ChatWidget &&
       window.ChatWidget.identify('visitor@example.com', { name: 'Jane Doe' });
    

    with the signed-in user's real email (your site's template fills it in). The channel page shows the exact line to copy under Optional: identify a known visitor; the name after window. may differ from ChatWidget, and ChatWidget works either way. Because the widget loads async, run it after the page has loaded (e.g. on window's load event); if the widget isn't ready yet, the call simply does nothing.

Signing the email

This step is optional and needs a server of your own: without it, identify() still saves the email and details on the visitor. user_hash proves the email came from your website and not from someone typing it into their browser. Your server makes it with the Identity secret from the channel's page (under Protect your chat): it is the HMAC-SHA256 of the exact email you pass, written as hex.

// PHP
$userHash = hash_hmac('sha256', $user->email, 'YOUR_IDENTITY_SECRET');
// Node.js
const userHash = require('crypto')
   .createHmac('sha256', 'YOUR_IDENTITY_SECRET')
   .update(user.email)
   .digest('hex');
# Python
user_hash = hmac.new(b'YOUR_IDENTITY_SECRET', user.email.encode(), hashlib.sha256).hexdigest()

Put the result in your page next to the email, as user_hash with the details: identify(email, { name: 'Jane Doe', user_hash: 'SIGNED_ON_YOUR_SERVER' }). You can also pass it as a third argument: identify(email, details, userHash).

  • Signed: if your site signed the same email in an earlier session on this channel, OneInbox moves those earlier conversations, lead form answers, and broadcast history onto the current session. The chat window shows their full history, and your Inbox shows one customer instead of two. Matching is per channel: the same email on two different widget channels stays two separate customers.
  • Not signed: the email (and any details) are saved on this visitor only. Their earlier conversations stay where they are and are never shown in this browser, and a later signed call never pulls this visitor's chat into someone else's history.
  • Signed wrongly: the call is refused and nothing is saved. The browser console says so. Check that you sign exactly the email you pass, with the current secret.

Sign on your server only. The identity secret must never appear in your page, your JavaScript or your app: anyone who has it can sign any email and read that customer's chat history.

Passing more details

You can also pass what else you know about the visitor, so the contact arrives filled in:

window.ChatWidget &&
   window.ChatWidget.identify('visitor@example.com', {
      name: 'Jane Doe',
      phone: '+1 555 010 0200',
      country: 'US',
      language: 'en',
      plan: 'Pro',
   });
  • name and phone replace what the contact has. country (two letters) and language are only filled in when the contact has none yet, since the widget already detects them.
  • Any other key fills the custom contact field with that key, such as plan above. Keys you haven't defined as a custom field are ignored.
  • A value that doesn't fit (a phone number that's too short, an option a select field doesn't have) is skipped; the rest are still saved.

Pass only what your own site knows about its signed-in user, never something a visitor typed into a form.

Every widget conversation appears in the same admin Inbox as WhatsApp, Telegram, Instagram, and Messenger conversations — there's nothing separate to check.

Widget not appearing at all? A strict Content-Security-Policy (CSP) header on your site can silently block the widget's <script> tag or its requests back to OneInbox. See Troubleshooting for what to add to your CSP.