Docs / Get started
Quickstart
A working chat takes two steps and a couple of minutes. Steps 3 and 4 are optional: they let the assistant know who is signed in and act in your app.
1. Make an app from your website
Create an account and enter your website. Dezzi does the rest at once:
- opens the chat to visitors on that site (and its
www.twin); - reads the page and the site’s sitemap for help content, within a minute;
- gives the chat five buttons to start a conversation with, which you can change under Settings → Chat options.
2. Paste one line
<script src="https://<your Dezzi address>/widget.js" data-app="pk_…" defer></script>
Your inbox shows this line with your address and app key filled in. Put it before </body> and the chat is live. For React, or your own screens, see the widget.
Server secrets
Steps 3 and 4 need a secret, made on the Install page and shown once:
- API key (
sk_…): your server’s, for the API. Never put it in a page or an app. - User token secret (
ut_…): your server signs who is signed in with it. - Action signing secret (
as_…): Dezzi signs every call to your app with it.
3. Tell Dezzi who is signed in (optional)
Your server signs a short token for the signed-in person (HS256, with the user token secret). sub is your id for them and exp at most a day ahead:
import { createHmac } from 'node:crypto';
const b64 = (v) => Buffer.from(typeof v === 'string' ? v : JSON.stringify(v)).toString('base64url');
export function dezziToken(user) {
const head = b64({ alg: 'HS256', typ: 'JWT' });
const body = b64({ sub: String(user.id), email: user.email, name: user.name, exp: Math.floor(Date.now() / 1000) + 600 });
const sig = createHmac('sha256', process.env.DEZZI_USER_TOKEN_SECRET).update(head + '.' + body).digest('base64url');
return head + '.' + body + '.' + sig;
}
Serve it from a route only signed-in people reach, and hand it to the widget:
Dezzi.identify(async () => (await fetch('/dezzi-token')).text());
Without a token the chat works for visitors only if you let it (Settings), and then it never uses your actions.
4. Give it one action (optional)
An action is an endpoint of your app. Dezzi calls it with POST, a signed body, and the person from the token your server signed, never from the model. Start with a read-only one:
app.post('/dezzi/actions', express.raw({ type: 'application/json' }), async (req, res) => {
if (!fromDezzi(req.body.toString(), req.get('x-support-signature') ?? '')) return res.status(401).end();
const call = JSON.parse(req.body);
if (call.action === 'get_orders') {
const orders = await db.orders.findMany({ where: { userId: call.user.id }, take: 5 });
return res.json({ orders: orders.map((o) => ({ id: o.id, status: o.status, total: o.total })) });
}
res.status(404).json({ ok: false, reason: 'Unknown action' });
});
Add it on the Actions page as a read action. fromDezzi and the whole envelope are in Actions. Refunds and other changes are propose actions: your app checks them, you approve them in the inbox, and only then do they run.
Then
- Write your instructions and procedures on the Assistant page, and add more help pages under Knowledge.
- Save a few scenarios, run them on the draft, and publish.
- Turn on alerts under Alerts and integrations.
- Read what people tell you under Feedback and security: the assistant passes on ideas, praise and complaints, and security weaknesses people report. Security reports are shown to owners and admins only, and alerts and your webhook carry their id, never their words. The assistant never tests or confirms a report.