Developer docs
Everything you need to connect Zellwo to your website, your backend and your AI assistant. Every snippet on this page already points at this workspace.
What Zellwo is
Zellwo is an AI support desk and an event-driven CRM. A chat widget answers your visitors from your own catalogue and knowledge base, every conversation lands in one inbox, and the events your site and your backend send move each contact through your CRM.
You connect to it through three doors:
- widget.js in the browser: the chat bubble or search bar, plus
zellwo.event()for analytics. This is the browser SDK; there is no other package to install. JavaScript reference - The REST API from your server: events, contacts, companies, conversations and every other dashboard action, described by an OpenAPI spec you can generate a client from. REST API reference
- The MCP connector for Claude, ChatGPT and Claude Code: the same operations as tools, with the permissions of whoever connects. Connect an assistant
Which flow do you need
Widget only (JS)
widget.js on your pages. Anonymous visitors tracked, returning ones recovered by fingerprint, identity via a userToken your server signs, expiring within 24 hours.
Widget + API
The widget covers anonymous browsing; your backend adds what only it knows (payments, refunds) and passes session_id so both land on one profile.
API only
No widget, so no session_id and no fingerprinting. Every event must carry an email, phone or external_id you already hold. Anonymous traffic is out of scope.
Install the chat widget
- An owner creates the workspace's widget keys once, on Apps → Website chat (Create widget keys). The same page then holds the widget configuration.
- Paste one of these before the closing body tag on every page. Pick the chat bubble, the assistant, the search bar, or analytics only (no chat UI):
<script>
window.zellwo = window.zellwo || { _q: [], event: function (a, e, i) { this._q.push([a, e, i]); } };
window.ZellwoWidgetInit = { mode: 'bubble', position: 'bottom-right' };
zellwo.event('consent', 'default'); // EU, UK, CH: nothing stored until 'accepted'
var zellwoScript = document.createElement('script');
zellwoScript.async = true;
zellwoScript.src = 'https://zellwo.zellwo.com/widget.js';
document.head.appendChild(zellwoScript);
</script>
<script>
window.zellwo = window.zellwo || { _q: [], event: function (a, e, i) { this._q.push([a, e, i]); } };
window.ZellwoWidgetInit = { mode: 'assistant', label: 'Assistant' };
zellwo.event('consent', 'default'); // EU, UK, CH: nothing stored until 'accepted'
var zellwoScript = document.createElement('script');
zellwoScript.async = true;
zellwoScript.src = 'https://zellwo.zellwo.com/widget.js';
document.head.appendChild(zellwoScript);
</script>
<script>
window.zellwo = window.zellwo || { _q: [], event: function (a, e, i) { this._q.push([a, e, i]); } };
window.ZellwoWidgetInit = { mode: 'search', placeholder: 'Ask us anything…' };
zellwo.event('consent', 'default'); // EU, UK, CH: nothing stored until 'accepted'
var zellwoScript = document.createElement('script');
zellwoScript.async = true;
zellwoScript.src = 'https://zellwo.zellwo.com/widget.js';
document.head.appendChild(zellwoScript);
</script>
<script>
window.zellwo = window.zellwo || { _q: [], event: function (a, e, i) { this._q.push([a, e, i]); } };
zellwo.event('consent', 'default'); // EU, UK, CH: nothing stored until 'accepted'
var zellwoScript = document.createElement('script');
zellwoScript.async = true;
zellwoScript.src = 'https://zellwo.zellwo.com/widget.js';
document.head.appendChild(zellwoScript);
</script>No client_id is needed: the script reads this workspace's key itself. The first line is a queue, so zellwo.event() calls made before the script has loaded are kept and sent on arrival. React, Vue or Next.js: put it in index.html, not inside a component.
Colours, the welcome preview, product suggestions and pageview tracking are set without code under Apps → Website chat. That page also holds this snippet in its Install section.


Allowed origins
The widget runs only on the addresses you list. Add your live domain, and your local one while developing (for example http://localhost:5173), under Apps → Website chat → Allowed origins. Anywhere else the browser console prints a [Zellwo] warning naming the blocked origin, and nothing is sent: check the console first when nothing arrives.

Identify signed-in users
A page cannot be trusted to say who is signed in, so your server vouches for the visitor with a userToken: a JWT signed with HS256 and the widget signing secret, carrying email and/or phone and optionally your own external_id. A verified token writes those onto the contact as verified fields and folds the visitor's anonymous history into their customer profile.
- The signing secret is under Apps → Website chat → User identity; owners only. It is revealed once; after that it can only be rotated. It never goes into page code and is not an API token.
expis required, at most 24 hours ahead; a token expiring later is refused. Tokens withoutexpare accepted and logged until 1 December 2026, and refused after.- Send it once per session, on any page, not only from your login page: a returning visitor arrives already signed in and never passes through it.
Sign on your server, with exp, and print the token into the page for the signed-in visitor:
claims = {'email': user.email, 'exp': int(time.time()) + 3600} # exp: required, at most 24 hours ahead
token = jwt.encode(claims, ZELLWO_SIGNING_SECRET, algorithm='HS256')zellwo.event('login', {}, { userToken: '<the token signed above>', firstName: 'Ada' });Signing code for every language is under Events from your server; the claims and platform examples (Django, Next.js, WooCommerce, Shopify) are in the JavaScript reference.

An assistant in your customer panel
Put the chat inside your own signed-in area and your customers can ask about their own account ("How many orders do I have?", "Move my booking to Friday"). Zellwo answers by calling your API, as that customer, with no colleague in between. The AI never sees or types who the customer is: Zellwo fills that in from the id on the customer's contact. The AI does fill the other details, such as a booking code, so your API must check that what is named belongs to that customer.
- Tell Zellwo who is signed in. Either sign the customer on your server, as under Identify signed-in users, with your own id for the customer in the token as
external_id; or send an event from your server, as under Events from your server, that carries the chat'ssession_idand the customer'sexternal_id. Tell Zellwo when they sign out. - Write one endpoint per question or change on your API. It takes the customer id and a few narrow details, and answers with a short JSON body.
- Connect each endpoint as a tool of a custom app under Apps, with the customer id set to Customer's verified external id. Such a tool runs only when the message proves who is writing: your sign-in, a sign-in link Zellwo emailed to the customer's address, or an email from that address that passed the sender check.
- Set the tool to Always allow under AI agent › Permissions. Reads and changes then run at once, in every conversation of that department.
# A read: "How many orders did I place last week?"
GET https://api.your-shop.example/assistant/customers/{customer_id}/orders/summary?from=2026-11-23&to=2026-11-29
X-Api-Key: <the key you made for Zellwo>
200 {"orders": 4, "total": "312.40 EUR", "latest": [{"order": "A1042", "status": "shipped"}]}# A change: "Move my booking to Friday"
POST https://api.your-shop.example/assistant/customers/{customer_id}/bookings/{booking}/move
X-Api-Key: <the key you made for Zellwo>
Idempotency-Key: bot:5f1c…
{"new_date": "2026-12-04"}
200 {"booking": "B77", "status": "moved", "date": "2026-12-04"}
200 {"booking": "B77", "status": "moved", "date": "2026-12-04"} # the same Idempotency-Key again: same answer, nothing done twice
404 {"error": "not_found", "message": "You have no booking B77."}
409 {"error": "not_eligible", "message": "A booking can be moved until 24 hours before it starts."}Your API has the last word on every call:
- Check the key, so you know the call comes from Zellwo.
- Take the customer from the id Zellwo sent, and check that the order or booking in the call belongs to them. Treat every other value as written by a stranger.
- Make every change safe to repeat: the same call twice must not charge, send or book twice. Each change the AI runs arrives with an
Idempotency-Keyheader: return the first answer when the same key comes again. - Return only what that customer may see, and no text written by someone else: the AI reads every field you return.
- Refuse with JSON carrying
error(not_found,not_eligible,invalid_params) and a shortmessage; the AI tells the customer your message in its own words. Answerunavailableor a 5xx only when your API is really down: Zellwo then pauses the whole app for a minute.
If an AI coding assistant writes the backend for you, give it these rules:
Build the backend for a Zellwo assistant in our customer panel. Reference: https://zellwo.zellwo.com/docs/js.md
Goal: a signed-in customer asks the Zellwo chat about their own account and changes it. Zellwo calls our API
with the customer id filled in by Zellwo; the AI model fills only the other inputs.
Who is signed in (pick one, never trust the page):
- Signed token: the backend signs an HS256 JWT with ZELLWO_SIGNING_SECRET (backend environment only) carrying
external_id (our permanent customer id as a string), email (lowercased) and exp (now + 300 seconds), freshly
on every current-user call. The frontend calls zellwo.event('login', {}, { userToken }).
- Or server to server: on each request of the signed-in customer, POST /api/analytics/ingest with the
integration token and {event, session_id, external_id, email}. session_id is the value of the cookie whose
name starts with zellwo_session_id: on THIS request; never store it and send it later, and send nothing
when the request carries more than one such cookie.
- On sign-out call zellwo.event('logout') before the redirect. When the session ends any other way (timeout,
password change, blocked account) send {event: 'logout', session_id} from the backend.
The endpoints (one per question or change, under their own path such as /assistant/customers/{customer_id}/...):
- Authenticate with a key used only by Zellwo (compare in constant time). The key opens only these endpoints:
no list or search across customers, no admin operation. Log every call with the customer id.
- The customer is the customer_id Zellwo sent and nothing else. Load every order or booking through that
customer, and answer 404 {"error": "not_found"} the same way for "does not exist" and "not theirs".
- Treat every other input as written by a stranger: validate dates, codes and statuses against fixed rules.
Count failed lookups per customer and rate-limit each customer.
- Answer JSON only, with a JSON Content-Type, within 10 seconds and under 256 KB: totals already counted, lists
capped, only fields this customer may see. No card numbers, passwords or identity numbers, and no text
written by someone else (a seller's note, a courier's comment).
- Every change is safe to repeat. Zellwo sends an Idempotency-Key header with each change: store it with the
change and return the first answer if the same key comes again. A customer asking twice arrives with two
keys, so also guard the change with a database lock or a unique constraint. Nothing may be charged, sent
or created twice.
- Refuse with {"error": "<code>", "message": "<one plain sentence for the customer>"}; code is one of
not_found, not_eligible, invalid_params, not_verified, rate_limited. Use unavailable or a 5xx only when the
API is really down.
- Tests per endpoint: own data works; another customer's id or order is not_found; a repeated change happens
once; a missing or wrong key is 401; bad input is invalid_params.
When done, list for me per endpoint the method, path, inputs and one example answer, so I can add each as a
tool in Zellwo with customer_id set to "Customer's verified external id" and the tool on Always allow.The step-by-step version, screen by screen, is the guide Put the assistant in your customer panel (needs a sign-in).
Events from the browser
With the snippet on the page, call zellwo.event(action, extraData, identification) anywhere. Standard names (pageview, register, login, logout, purchase, view_item, add_to_cart, checkout, search, click, form_submit) go as they are; anything else takes the custom: prefix.
zellwo.event('view_item', { product_id: 'SKU-42', product_name: 'Widget Pro', price: 79.99 });
zellwo.event('purchase', { order_id: 'ORD-9821', amount: 129.99, currency: 'EUR' });
zellwo.event('custom:video_played', { video_id: 'demo', seconds: 45 });- Record the first page of a visit is on by default: the script sends one
pageviewfor the page it loads on when the browser had no Zellwo session yet, the landing page a server cannot report. - Send a pageview automatically is off by default. Switched on, the script also records every later page load and client-side route change. Off, call
zellwo.event('pageview')yourself, from your router in a single-page app. Both switches are under Apps → Website chat → Events. - Send
order_idwith everypurchase: a second purchase with the sameorder_idfor the same contact is stored once.
Every option, method and event in the JavaScript reference
Events from your server
What only your backend knows (a webhook-confirmed payment, a refund, a plan change) goes to POST https://zellwo.zellwo.com/api/analytics/ingest, or /ingest/batch for up to 100 events. Authenticate with a token from Settings › API & MCP (an integration for your backend), never the signing secret.
- Read the visitor's session. widget.js stores it in a first-party cookie on your own domain,
zellwo_session_id:<client_id>, so every request to your server carries it. Send it assession_idand the event lands on the profile the browser already built. Match the cookie by prefix and you never hardcode the key. The first request of a visit has no cookie yet; the first-page setting above covers it. - Add what you know.
email,phoneorexternal_idname the person;ipanduser_agentdescribe the visitor instead of your server;company_namecreates and links their company. The first event that carries both the session and the email folds the anonymous profile into the customer's. Your server is authenticated, so it needs no userToken for this. - An event can sign a browser in. From an integration token, an event that carries a
session_idand a customer'sexternal_idor email makes that browser's chat the verified customer for the hours that follow. So send a customer's id with a session only inside a request their own signed-in browser is making, never from a stored session id (a payment webhook, a queue retry), and sendemail_verified: falsewith an address someone only typed. - Skip what you cannot identify. An event with no session, email, phone or external_id is accepted with 204 and then dropped, so nothing tells you at call time. Open a contact in the dashboard after your first send.
import time
import jwt # pip install pyjwt requests
import requests
ZELLWO_URL = 'https://zellwo.zellwo.com'
def zellwo_user_token(email: str) -> str:
"""The userToken for a signed-in visitor, signed with the widget signing secret."""
return jwt.encode({'email': email.lower().strip(), 'exp': int(time.time()) + 3600}, ZELLWO_SIGNING_SECRET, algorithm='HS256')
def send_zellwo_event(request, event: str, properties: dict) -> None:
"""One event for the visitor behind this Django request; nothing when nobody can be identified."""
session_id = next((value for name, value in request.COOKIES.items() if name.startswith('zellwo_session_id:')), None)
payload = {'event': event, 'session_id': session_id, 'url': request.build_absolute_uri(), 'ip': request.META.get('REMOTE_ADDR'), 'user_agent': request.META.get('HTTP_USER_AGENT'), 'properties': properties}
if request.user.is_authenticated:
payload.update(email=request.user.email, external_id=str(request.user.pk))
if not any(payload.get(field) for field in ('session_id', 'email', 'phone', 'external_id')):
return
requests.post(f'{ZELLWO_URL}/api/analytics/ingest', json=payload, headers={'Authorization': f'Bearer {ZELLWO_TOKEN}'}, timeout=5)// npm install jsonwebtoken (Node 18+ has fetch built in)
import jwt from 'jsonwebtoken';
const ZELLWO_URL = 'https://zellwo.zellwo.com';
export function zellwoUserToken(email) {
return jwt.sign({ email: email.toLowerCase().trim(), exp: Math.floor(Date.now() / 1000) + 3600 }, process.env.ZELLWO_SIGNING_SECRET, { algorithm: 'HS256' });
}
export async function sendZellwoEvent(req, event, properties = {}) {
const sessionId = Object.entries(req.cookies ?? {}).find(([name]) => name.startsWith('zellwo_session_id:'))?.[1];
const payload = { event, session_id: sessionId, email: req.user?.email, url: `${req.protocol}://${req.get('host')}${req.originalUrl}`, ip: req.ip, user_agent: req.get('user-agent'), properties };
if (!payload.session_id && !payload.email) return;
await fetch(`${ZELLWO_URL}/api/analytics/ingest`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${process.env.ZELLWO_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
}// composer require firebase/php-jwt
use Firebase\JWT\JWT;
const ZELLWO_URL = 'https://zellwo.zellwo.com';
function zellwo_user_token(string $email): string {
return JWT::encode(['email' => strtolower(trim($email)), 'exp' => time() + 3600], getenv('ZELLWO_SIGNING_SECRET'), 'HS256');
}
function send_zellwo_event(string $event, array $properties = [], ?string $email = null): void {
$session_id = null;
foreach ($_COOKIE as $name => $value) {
if (str_starts_with($name, 'zellwo_session_id:')) $session_id = $value;
}
if (!$session_id && !$email) return;
$payload = array_filter(['event' => $event, 'session_id' => $session_id, 'email' => $email, 'ip' => $_SERVER['REMOTE_ADDR'] ?? null, 'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? null, 'properties' => $properties]);
$curl = curl_init(ZELLWO_URL . '/api/analytics/ingest');
curl_setopt_array($curl, [CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_TIMEOUT => 5, CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('ZELLWO_TOKEN'), 'Content-Type: application/json']]);
curl_exec($curl);
}curl -X POST https://zellwo.zellwo.com/api/analytics/ingest \
-H "Authorization: Bearer $ZELLWO_TOKEN" \
-H "Content-Type: application/json" \
-d '{"event": "purchase", "email": "[email protected]", "properties": {"order_id": "ORD-9821", "amount": 129.99, "currency": "EUR"}}'
# A userToken from the shell (HS256 with the widget signing secret, valid one hour)
b64url() { base64 | tr -d '=\n' | tr '/+' '_-'; }
header=$(printf '{"alg":"HS256","typ":"JWT"}' | b64url)
claims=$(printf '{"email":"[email protected]","exp":%s}' $(( $(date +%s) + 3600 )) | b64url)
signature=$(printf '%s.%s' "$header" "$claims" | openssl dgst -sha256 -hmac "$ZELLWO_SIGNING_SECRET" -binary | b64url)
echo "$header.$claims.$signature"- Send from a queue rather than the request thread, and batch imports and syncs through /ingest/batch.
- Pick one source per event type: browser for what the page sees, server for payments and anything that must carry external_id. The same action from both counts twice (purchases with the same order_id excepted).
- Never put your own framework's session id or a Google Analytics client id in session_id: it is verified against your embed key, so it identifies nobody.
- Retry only 429, 500 and 503. A 204 was accepted; retrying it duplicates the event.
REST API and tokens
Every dashboard action is an endpoint under https://zellwo.zellwo.com/api/, JSON in and out, with Authorization: Bearer <token>. Tokens are made under Settings › API & MCP; the API itself creates only integration tokens.
A personal token acts as you; an integration token is your website or backend posting as itself. Compare the two in the API reference.
- Rate limit: 600 requests per minute per IP (10000 for analytics ingest). A
429means wait and retry. - Generate a client in any language from the OpenAPI spec:
https://zellwo.zellwo.com/api/openapi.json.

Claude and ChatGPT (MCP)
Every operation of the REST API is also an MCP tool of the same name. Connect the workspace as a custom connector and the assistant works with your conversations, contacts and campaigns as you.
https://zellwo.zellwo.com/mcp- In Claude (Settings → Connectors → Add custom connector) or ChatGPT (Settings → Connectors → Create), paste the URL above.
- Sign in with your Zellwo account when asked and press Allow. The assistant acts as you: staff, admin or owner.
- Ask it to start with the overview — every action in this dashboard is available as a tool, and the API reference documents them.
Disconnect from the assistant's settings at any time; tokens expire after 90 days without use.
No sign-in flow? Use a token
Claude Code, scripts and curl cannot open a browser. Create a personal token under Settings › API & MCP and send it as a bearer header — it acts as you, with your level, and you can revoke it any time.
claude mcp add --transport http zellwo https://zellwo.zellwo.com/mcp --header "Authorization: Bearer <token>"
Channels and catalogue
- Apps: Website chat, your own mailbox (SMTP out, IMAP in), SendGrid (sending, and Inbound Parse for receiving) and Zellwo SMS. Each has its own page where you set how it sends and receives.
- Catalogue sources: a Google Shopping feed, CSV or JSON, Shopify or WooCommerce, synced into the products the assistant answers from.
- Guides: step-by-step walkthroughs with screenshots for each source type and for campaigns.
