Replyze developer docs: live chat widget, JavaScript API, REST API and webhooks
Replyze is AI customer support for your website: an AI agent that answers from your knowledge base and hands the chat to your team when it should, live chat on your site, and one shared inbox for web chat, email, WhatsApp and Telegram (Messenger and Instagram are in beta). This repository is the developer reference: how to embed the chat widget, control it from JavaScript, verify signed-in users, use the REST API, receive webhooks and connect AI agents over MCP. Every example in examples/ runs as is.
Create a free account · Live demo · OpenAPI spec
Quickstart: your first API call
Get an API key. Create a free account, open Settings → Integrations → Developer and create a key with the conversations:read scope. The key starts with rpz_live_ and is shown once. Whether a workspace has the REST API depends on its plan (pricing); without it, calls answer 403 plan_required.
Check the key.
export REPLYZE_API_KEY=rpz_live_...
curl https://client.replyze.chat/api/v1/me -H "Authorization: Bearer $REPLYZE_API_KEY"
The answer names the key, its scopes and its workspace:
{"object":"api_key","id":7,"name":"My first key","prefix":"rpz_live_AbC123","scopes":["conversations:read"],"expires_at":null,"workspace":{"id":1,"name":"Acme"}}
List your open conversations.
curl "https://client.replyze.chat/api/v1/conversations?status=open&limit=5" -H "Authorization: Bearer $REPLYZE_API_KEY"
Next: send a reply from Node.js, Python or PHP, receive webhooks, or put the chat on your site. The live demo is replyze.chat itself: the chat bubble in the bottom-right corner is the Replyze widget.
Contents
- Add the chat widget to your site
- JavaScript API
- Identity verification
- REST API
- Webhooks
- MCP server for AI agents
- More from Replyze
- Development
1. Add the chat widget to your site
Paste this before </body> on every page. Your widget token (wgt_...) is in the dashboard under Settings → Integrations → Install widget, which also shows this snippet with your token filled in.
<script>
window.ReplyzeConfig = {
token: 'wgt_YOUR_TOKEN_HERE',
apiUrl: 'https://client.replyze.chat'
};
</script>
<script src="https://cdn.replyze.chat/widget.js" async></script>
The script loads asynchronously, so it doesn't hold up your page. A full page with the JavaScript API wired up is in examples/widget/index.html.
Where the snippet goes on WordPress, Shopify, Wix, Webflow, Google Tag Manager, React, Laravel and other platforms, with a troubleshooting list (allowed domains, Content-Security-Policy, ad blockers): add-live-chat-to-website. Packages that do it for you: React and Next.js, Vue and Nuxt, WordPress, React Native and Expo, Flutter.
Options
window.ReplyzeConfig |
What it does |
token |
Your widget token. Required. |
apiUrl |
The Replyze API. https://client.replyze.chat (the default). |
language |
The chat's interface language ("de", "pt-BR", "ar"...), over the visitor's browser and the widget settings. |
tracking |
false turns off visitor tracking (the visitor cookie, page views and heartbeats), for example until the visitor accepts analytics cookies. The chat works either way. Turn it on later with Replyze.setTracking(true). |
overrides |
Look and behaviour set from your page, each one over the dashboard's widget settings: color ("#1eabd2" or rgb(...)), position ("bottom_left" or "bottom_right"), theme ("light" or "dark"), bot_name, bot_avatar (an https URL), welcome_message, show_greeting_teaser (true/false), auto_open_delay (seconds, 0 to 300). A value that doesn't fit is ignored. |
Without an inline script
If your Content Security Policy doesn't allow inline scripts, put the settings on the script tag:
<script src="https://cdn.replyze.chat/widget.js"
data-token="wgt_YOUR_TOKEN_HERE"
data-api-url="https://client.replyze.chat"
data-language="en"
async></script>
data-tracking="false" turns off visitor tracking, as tracking: false does above.
2. JavaScript API
Once the script has loaded, window.Replyze controls the widget.
| Method |
What it does |
Replyze.open() / close() / toggle() |
Open, close or toggle the chat window |
Replyze.show() / hide() |
Show or hide the launcher and the chat; the widget keeps running while hidden |
Replyze.identify(email, name) |
Tell the chat who the visitor is |
Replyze.identify({ user_id, email, name, user_hash }) |
The same for a signed-in user, verified with a signature from your server: see Identity verification. Another person than the one this browser was identified as (another user_id, or else another email) starts as a new visitor first, as after reset() |
Replyze.setUser({ email, name, data }) |
Name and email, plus custom data in data |
Replyze.setData({ plan: 'pro', seats: 12 }) |
Custom data on the visitor's contact: text, numbers, true/false, or null to remove a key. Keys that match a contact field fill it; others are kept as extra data. Up to 50 keys at a time. |
Replyze.pushEvent('Signed up', { plan: 'pro' }) |
An event on the visitor's timeline in the inbox, with the page it happened on. Names are 1 to 64 characters. |
Replyze.setLanguage('de') |
The chat's interface language, over the browser's and the widget settings |
Replyze.sendMessage('Hi!') |
Send a message as the visitor |
Replyze.openArticle(12) |
Open the widget on a help article (the widget needs its Home or Help tab) |
Replyze.setTracking(false) |
Turn visitor tracking off or on, for example from a cookie banner |
Replyze.reset() |
The visitor signed out of your site: forget them (chat, contact, visitor cookie), also in your site's other open tabs. The next chat starts as a new visitor. Safe to call as the page loads, while the widget is still restoring the previous visitor's chat. |
Replyze.on(event, callback) / off(event, callback) |
Listen to the events below |
Events
| Event |
When |
Callback gets |
ready |
The widget has started: once, after the calls queued before the script loaded have run and window.Replyze is the widget's API, so a queued on('ready', ...) hears it. A listener added after that is called right away. (Before 13 November 2026 the widget fired it too early for any listener.) |
nothing |
open / close |
The chat window opened or closed |
nothing |
message:sent |
The visitor sent a message |
{ text }, or { file } for an upload |
message:received |
A reply arrived from the AI or the team |
the message |
identified |
identify() went through |
{ verified }: true when the signature checked out |
reset |
reset() finished |
nothing |
unread |
The unread count changed (the launcher's badge) |
the count |
Replyze.on('unread', (count) => {
document.querySelector('#help-badge').textContent = count || '';
});
Calls before the script has loaded
The script is async, so window.Replyze doesn't exist for the first moments. Calls made earlier can wait in a queue that the widget runs when it starts:
<script>
window.ReplyzeConfig = { token: 'wgt_YOUR_TOKEN_HERE', apiUrl: 'https://client.replyze.chat' };
window.Replyze = window.Replyze || { _queue: [] };
</script>
<script src="https://cdn.replyze.chat/widget.js" async></script>
<script>
// Runs the call now if the widget is there, else queues it.
function replyze(method, ...args) {
if (window.Replyze && window.Replyze._initialized) window.Replyze[method](...args);
else window.Replyze._queue.push([method, ...args]);
}
replyze('on', 'open', () => console.log('The chat was opened'));
replyze('identify', 'jane@example.com', 'Jane Doe');
</script>
3. Identity verification
Without verification, identify() only labels the visitor. With it, a signed-in user of your site becomes the same contact on every device and browser, marked as verified in the inbox, and nobody can chat as someone else by calling identify() with their email.
- Turn it on in Settings → Chat Widget → Identity (owners and admins). Copy the secret it creates and keep it on your server only.
- When a user is signed in, your server computes
user_hash: the hex HMAC-SHA256 of the user's id as a string, keyed with the secret. A user without an id is signed by their email in lower case, without spaces around it.
- The page passes it to the widget:
Replyze.identify({
user_id: '42', // the same id you signed
email: 'jane@example.com',
name: 'Jane Doe',
user_hash: '<the signature from your server>',
});
- When the user signs out, call
Replyze.reset() so the next person on that computer starts fresh.
A wrong user_hash changes nothing: the widget stays the anonymous visitor it was. With verification turned on, an identify() that has a user_id but no valid user_hash is refused.
On the server
// Node.js
const crypto = require('crypto');
const userHash = crypto.createHmac('sha256', process.env.REPLYZE_IDENTITY_SECRET)
.update(String(user.id))
.digest('hex');
# Python
import hashlib, hmac, os
user_hash = hmac.new(os.environ["REPLYZE_IDENTITY_SECRET"].encode(), str(user.id).encode(), hashlib.sha256).hexdigest()
// PHP
$userHash = hash_hmac('sha256', (string) $user->id, getenv('REPLYZE_IDENTITY_SECRET'));
Runnable versions with the email fallback are in examples/identity/. Check your code against this test vector (the secret is made up):
| Secret |
Signed |
user_hash |
f3a1c9e07b2d4e68a5c1d9b3e7f20486a9c3e5d7f1b3a5c7e9d1f3b5a7c9e1d3 |
user id 42 |
61b4b465a57ec25065d5a3b377329c00ab8e1c5562756729d26d880f39d8ec13 |
| same |
email Jane@Example.com (no id) |
74baeda7d2f63e1df51c7aeea059bcf644fdca57ec0fcaba9a0f7b0e1b5eaaf9 |
4. REST API
The REST API reads and changes one workspace: conversations and messages, contacts, the knowledge base and analytics. Whether your workspace has it depends on its plan (pricing