Skip to content

Quick Start

This guide walks through a production-ready setup path for Docuworm.

  • A Docuworm organization account
  • Access to dashboard.docuworm.ai
  • A web app where you can add HTML and JavaScript

In the dashboard:

  1. Open Agents.
  2. Create a new agent or select an existing one.
  3. In Settings, set agent name and whether page context should be enabled.
  4. In Actions, define quick actions your users should see in chat.

Detailed dashboard workflow: Dashboard Setup

In the same agent, open API Keys and create a token.

Add allowed URLs before creating the token. Use exact origins for each environment:

  • Local dev: http://localhost:5173 (or your exact local origin)
  • Staging: https://staging.yourdomain.com
  • Production: https://app.yourdomain.com

Important notes:

  • Localhost matching is strict by origin, including port.
  • If origin validation fails, widget authentication fails.
  • Keep tokens server-controlled in your deployment pipeline.
<docuworm-chat
access-token="worm_xxx_your_token"
thread-ref="case_12345"
theme="dark"
></docuworm-chat>
<script type="module">
import "https://cdn.docuworm.ai/docuworm.js";
</script>

Use a stable thread-ref that matches your app entity (case, ticket, order, account).

4. Open the widget and verify thread creation

Section titled “4. Open the widget and verify thread creation”
<script type="module">
import {
openWidget,
waitForThreadId,
} from "https://cdn.docuworm.ai/docuworm.js";
const widget = document.querySelector("docuworm-chat");
async function verifyThread() {
openWidget(widget);
const threadId = await waitForThreadId({ element: widget, timeoutMs: 30000 });
console.log("Docuworm thread ready:", threadId);
}
verifyThread().catch((error) => {
console.error("Thread setup failed:", error);
});
</script>

Use the widget UI to send a real prompt after it opens (for example: "Summarize this case.").

This confirms end-to-end chat is working with your token, origin, and thread routing.

You can combine user uploads in the widget UI with programmatic context.

<script type="module">
import { addSources, uploadFilesOnReady } from "https://cdn.docuworm.ai/docuworm.js";
const widget = document.querySelector("docuworm-chat");
addSources(
[
{
title: "Case Summary",
text: "Customer reported duplicate charge on card ending 4242.",
category: "case",
},
],
widget,
);
uploadFilesOnReady(["https://example.com/statement.pdf"], widget).catch(console.error);
</script>