WhatsBuddy

WhatsBuddy

Chat on your site, controlled from the page

Paste one script. Open and close the window, fill the composer from a link, and hand the agent the page the visitor is on.

  • Your button

    Hide the bubble and open the chat from a button you already have.

  • Prefilled links

    A URL can fill the composer, open the window, or send the first line.

  • Page context

    Tell the agent which room, plan, or page the visitor is looking at.

  • One script

    The same widget.js tag is the embed and the JavaScript API.

Add the widget

Create a widget in the app, allow your hostname, and paste this on the page. Calls made before the script loads are queued.

<script>
  window.WhatsBuddy = window.WhatsBuddy || function () {
    (WhatsBuddy.q = WhatsBuddy.q || []).push(arguments);
  };
  WhatsBuddy('setContext', { plan: 'Pro' });
</script>
<script
  src="https://whatsbuddy.com/widget.js"
  data-key="WIDGET_PUBLIC_KEY"
  async
></script>

From your page

Open, fill, and tell it where they are

The script adds window.WhatsBuddy. One widget per page.

  1. Open and close

    WhatsBuddy.open(), close(), and toggle(). The app can hide the Live Chat button. Your page then calls WhatsBuddy.open().

  2. Prefill or send

    setMessage('Table for 2') fills the box.sendMessage('Table for 2') opens the window and sends it.

  3. Page context

    setContext({ room: '12' }) merges keys. The agent sees the snapshot when it changes, not on every message.

Style the button

Set the look in the app, or override it on the page. InWebsite widgets you can change the title, greeting, placeholder, light or dark theme, left or right side, button label, button color, reply line, and whether the button is shown. Copy the snippet from there. An attribute on the script wins for that page.

<script
  src="https://whatsbuddy.com/widget.js"
  data-key="WIDGET_PUBLIC_KEY"
  data-title="Chat now"
  data-greeting="This is where it begins"
  data-placeholder="Message…"
  data-theme="light"
  data-position="right"
  data-button-label="Live Chat"
  data-button-bg="#25d366"
  data-reply-time="We reply within 7 seconds"
  data-offset-bottom="80"
  async
></script>
AttributeWhat it setsDefault
data-keyPublic key from the app. Required.
data-titleHeading in the chat windowChat now
data-greetingText when the chat is emptyThis is where it begins
data-placeholderComposer placeholderMessage…
data-themelight or darklight
data-positionright or leftright
data-button-labelLabel on the buttonLive Chat
data-button-bgButton color, #rgb or #rrggbb#ffffff
data-reply-timeStatus line under the titleWe reply within 7 seconds
data-offset-bottomClosed button distance from the bottom, in px16
data-open1 opens the window on loadclosed
data-messageComposer text on load. Does not send.
data-suggestionsStarter chips, separated with |
data-launcherhidden until your page calls WhatsBuddy.open()visible
data-page-context0 skips the page URL, title, and referrercollected

Move it with CSS

The closed button is an iframe with the class whatsbuddy-button. Select that from your stylesheet to change where it sits. Your rule wins overdata-offset-bottom. Color and label stay on the attributes above, or in the app, because the button face is drawn inside the frame.

<style>
  .whatsbuddy-button {
    bottom: 80px;
    right: 24px;
  }
</style>

.whatsbuddy-widget--open is the desktop window..whatsbuddy-widget--modal is the phone overlay..whatsbuddy-widget--left is set when the button is on the left.

Put the chat where the question starts

The visitor stays on your site. You still read the thread in WhatsBuddy.