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.
Open and close
WhatsBuddy.open(),close(), andtoggle(). The app can hide the Live Chat button. Your page then callsWhatsBuddy.open().Prefill or send
setMessage('Table for 2')fills the box.sendMessage('Table for 2')opens the window and sends it.Page context
setContext({ room: '12' })merges keys. The agent sees the snapshot when it changes, not on every message.
Links can start the chat
The widget reads these from your page URL. wbopen=0 stays closed even when the snippet says data-open="1".
https://hotel.example/rooms/12?wbmessage=Is%20Friday%20open%3F
https://hotel.example/rooms/12?wbmessage=Hold%20Friday&wbsend=1
https://hotel.example/contact?wbopen=1
https://hotel.example/pricing?wbmessage=Pro%20plan&wbopen=0The page URL, title, and referrer are sent with the chat unless you setdata-page-context="0". Custom fields stay in JavaScript, not in the query string. Operators see the current page on the website chat in Messenger.Create a widget
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>| Attribute | What it sets | Default |
|---|---|---|
data-key | Public key from the app. Required. | |
data-title | Heading in the chat window | Chat now |
data-greeting | Text when the chat is empty | This is where it begins |
data-placeholder | Composer placeholder | Message… |
data-theme | light or dark | light |
data-position | right or left | right |
data-button-label | Label on the button | Live Chat |
data-button-bg | Button color, #rgb or #rrggbb | #ffffff |
data-reply-time | Status line under the title | We reply within 7 seconds |
data-offset-bottom | Closed button distance from the bottom, in px | 16 |
data-open | 1 opens the window on load | closed |
data-message | Composer text on load. Does not send. | |
data-suggestions | Starter chips, separated with | | |
data-launcher | hidden until your page calls WhatsBuddy.open() | visible |
data-page-context | 0 skips the page URL, title, and referrer | collected |
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.