Overview
Three surfaces work together: the browser widget, public read-only config, and the chat completion API.
- Widget —
/chatbot-widget.json your site; authenticates with your project API key. - Config —
GET /api/chatbot/config— returns enabled flag, welcome text, theme (colors, layout), quick links metadata (used by the widget after load). - Chat —
POST /api/chatbot/chat— sends the user message + optional history andcontext(e.g. page URL/title) for grounded replies. - Project settings — Edited in-app under Project → Chatbot; stored on the project as
chatbotAgent(also exposed via authenticated GET/PATCH/api/projects/:id/chatbotfor the dashboard).
Prerequisites
- PRZIO project — Create or open a project; copy the project ID.
- API key — Generate a project API key (same key family as other PRZIO APIs). The widget and chat endpoint require
X-API-KeyorAuthorization: Bearer …. - AI provider — The host must have
OPENAI_API_KEYand/orOPENROUTER_API_KEYconfigured (environment or admin/project AI settings). Without this, chat returns503. - Enable the chatbot — In project chatbot settings, turn the agent on. If disabled,
POST /api/chatbot/chatreturns403.
License. Chatbot features may require a paid project plan in the app (trial projects are redirected to upgrade when opening the chatbot page).
Embed the widget
Add the script near the end of your HTML (e.g. before </body>). Replace the placeholder host with your PRZIO app URL (e.g. https://app.przio.com).
<script src="https://app.przio.com/chatbot-widget.js" data-base-url="https://app.przio.com" data-project-id="YOUR_PROJECT_ID" data-api-key="YOUR_API_KEY" async ></script>
Alternative: PrzioChatbotConfig
Set global config before the script runs if you prefer not to use data attributes:
window.PrzioChatbotConfig = {
baseUrl: 'https://app.przio.com',
projectId: 'YOUR_PROJECT_ID',
apiKey: 'YOUR_API_KEY'
};
Open programmatically
After load, the widget exposes a small API:
if (window.PrzioChatbot && window.PrzioChatbot.open) {
window.PrzioChatbot.open();
}
Where to start
See the PRZIO Chatbot overview for the editor screens, configuration tour, and the visual examples behind every option used below.
Runtime APIs
Base URL = your data-base-url (no trailing slash). All requests support CORS for browser use.
GET /api/chatbot/config
Auth: header X-API-Key or Authorization: Bearer <api-key>.
Returns JSON used by the widget: whether the bot is enabled, welcome message, theme (primary color, bubble mode, avatars, header text, panel min/max height, custom CSS fields), and quick-link settings when configured.
POST /api/chatbot/chat
Auth: same as config.
Body (JSON):
message(string, required) — user’s latest message.messages(array, optional) — prior turns for context; items withroleandcontent(recent history is truncated server-side).context(object, optional) — e.g.{ "url": "https://yoursite.com/pricing", "title": "Pricing" }for page-aware answers.
The server builds a system prompt from your project’s description, chatbotAgent fields (context, business info, knowledge doc, important URLs, suggested Q&A), and optional system prompt override. It appends page context when provided.
Headless clients. Mobile apps and backends can call POST /api/chatbot/chat directly with the same API key—no widget required.
Dashboard settings (chatbotAgent)
Configure these in Project → Chatbot. They feed the AI system prompt and the widget appearance.
| Field | Purpose |
|---|---|
enabled |
Master switch; when false, chat API returns 403. |
welcomeMessage |
First message visitors see when opening the widget. |
systemPromptOverride |
Optional full override of default instruction stacking; when set, project still adds scope, description, knowledge, URLs, Q&A, and page context per server logic. |
projectContext |
Extra plain-language context about the product (HTML stripped server-side). |
businessInformation |
Brand, policies, offerings—fed to the model as business context. |
knowledgeBaseDocumentText / knowledgeBaseDocumentFileName |
Extracted text from an uploaded knowledge doc (e.g. site FAQ); primary factual source when present. |
importantUrls |
Lines of URLs + notes; model is nudged to prefer these links when relevant. |
suggestedAnswers |
Approved Q&A (plain text or structured JSON in app); normalized for the prompt when JSON. |
showImportantLinksOnOpen, quickLinksIntro, quickLinksTitle |
Control the quick-links card when the panel opens. |
primaryColor, position |
Theme: hex color for header/bubble; bubble corner bottom-right | bottom-left | top-right | top-left. |
bubbleButtonMode, bubbleButtonIcon, iconUrl |
Launcher: default graphic, custom image URL, or emoji/icon string. |
avatarUrl, avatarMode, avatarIcon |
Assistant identity in header and messages (image or emoji). |
headerTitle, headerSubtitle, headerPadding, headerTitleColor, headerSubtitleColor |
Chat window chrome and optional header colors. |
allowedDomains |
One host per line or comma-separated; when non-empty, chat requests must include a context.url whose hostname matches (see below). |
openOnPageLoad |
Whether to open the panel automatically on first paint (when enabled). |
inputBoxCss, sendButtonCss, customCss |
Optional CSS fragments injected for advanced styling. |
panelMinHeight, panelMaxHeight |
Panel sizing (CSS lengths), e.g. min height and max height / viewport. |
Domain allowlist
If allowedDomains is non-empty, the chat API validates context.url (when provided). The visitor’s page hostname must match an allowed host (localhost variants are treated as allowed for development).
If the URL is missing, invalid, or not on the list, the API responds with 403 and a message to add the site in Chatbot settings.
Leave allowedDomains empty during early testing if you do not want hostname checks; tighten before production.
Common HTTP responses
| Code | Meaning |
|---|---|
| 400 | Missing message body field. |
| 401 | Missing/invalid API key. |
| 403 | Chatbot disabled for project, or domain not allowed. |
| 503 | No AI provider key configured on the server. |
Integration checklist
- Project created; chatbot enabled in dashboard.
- API key generated; snippet uses correct
data-base-url,data-project-id,data-api-key. - AI keys configured for the PRZIO deployment.
- Allowed domains configured for production (or cleared for staging).
- Widget loads; messages return assistant replies (test on a path that matches domain rules).
Need the marketing context?
Jump back to the chatbot product page for screenshots, use cases, and the high-level pitch you can share with stakeholders.