Quick Start
This guide walks through a production-ready setup path for Docuworm.
Prerequisites
Section titled “Prerequisites”- A Docuworm organization account
- Access to dashboard.docuworm.ai
- A web app where you can add HTML and JavaScript
1. Create or select an agent
Section titled “1. Create or select an agent”In the dashboard:
- Open Agents.
- Create a new agent or select an existing one.
- In Settings, set agent name and whether page context should be enabled.
- In Actions, define quick actions your users should see in chat.
Detailed dashboard workflow: Dashboard Setup
2. Create an access token
Section titled “2. Create an access token”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.
3. Embed the widget from the CDN
Section titled “3. Embed the widget from the CDN”<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>5. Send your first message
Section titled “5. Send your first message”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.
6. Add first context
Section titled “6. Add first context”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>