Skip to content

Widget Attributes

All configuration is done via data-* attributes on the <script> tag. No JavaScript API calls are needed.

Attribute Reference

AttributeTypeRequiredDefaultDescription
data-serverstringNohttps://widget.webnav.aiWebnav.ai backend server URL
data-base-urlstringYesThe website URL to crawl and index
data-themestringNolightColor theme: light or dark
data-langstringNoAuto-detectedUI language: zh, en, zht, ja
data-logostringNoWebnav.ai logoURL of a custom logo for the widget header
data-modestringNobubbleWidget display mode (fullscreen for mobile WebView)
data-excludestringNoComma-separated routes to exclude from crawling
data-positionstringNobottom-rightInitial bubble corner: bottom-right or bottom-left. Visitors can also drag the bubble (snaps to the nearest edge; position is remembered)
data-voicestringNoSet to true to enable voice input (server-side transcription, works where Google is blocked; falls back to browser Web Speech) + reply read-out (TTS, off by default). Dictation language and auto read-out are toggleable in the widget settings panel
data-user-tokenstringNoSigned visitor identity token for AI Actions (forwarded to your API as X-Webnav-User; also settable at runtime via window.WebnavWidget.setUserToken())

Examples

Minimal

html
<script src="https://widget.webnav.ai/widget/chat-widget.js" data-base-url="https://yoursite.com"></script>

Dark Theme with English UI

html
<script src="https://widget.webnav.ai/widget/chat-widget.js" data-base-url="https://yoursite.com" data-theme="dark" data-lang="en"></script>

Exclude Admin Routes

html
<script src="https://widget.webnav.ai/widget/chat-widget.js" data-base-url="https://yoursite.com" data-exclude="/admin,/login,/dashboard"></script>
html
<script src="https://widget.webnav.ai/widget/chat-widget.js" data-base-url="https://yoursite.com" data-logo="https://yoursite.com/logo.png"></script>

AI Model (BYOK)

AI conversations run on a model you configure yourself in Dashboard → AI Model. The widget stays hidden on your site until a model configuration passes the connectivity test.

ProviderBase URLNotes
OpenAI-compatibleRequired (e.g. https://api.openai.com/v1)Works with OpenAI, DeepSeek, Qwen, Moonshot, OpenRouter, self-hosted vLLM, and any OpenAI-compatible endpoint
Anthropic ClaudeOptional (defaults to official API)Native Messages API
Google GeminiOptional (defaults to official API)Native GenerateContent API
  • Your API key is encrypted at rest (AES-256-GCM) and never returned to the browser.
  • Saving runs a connectivity test; the widget only renders after the test passes.
  • If the model does not support tool calling, AI Actions (orders / tracking / refunds) is disabled automatically while Q&A keeps working.
  • Configuration changes take effect within about 1 minute.

Welcome Message (auto-open)

Pro and Enterprise plans can greet visitors automatically: the chat window opens by itself shortly after the visitor arrives, showing a configurable welcome message as the first bubble.

Configure it in Dashboard → Settings → Welcome Message (per domain):

FieldDescription
EnableTurn auto-open on/off for this domain
Text (Chinese / English)Up to 200 chars each. Chinese shows to zh/zht visitors, English to others; a blank field falls back to the other
Image URLOptional HTTPS image link (e.g. a support QR code), shown below the text

Behavior details:

  • Opens once per visit (per browser session), 3 seconds after page load; closing it keeps it closed for the rest of the visit.
  • Desktop only — on mobile the chat window is full-screen, so it never auto-opens there; visitors still see the bubble.
  • The welcome message is display-only: it is not stored in the visitor's chat history and is not part of the AI conversation context.
  • Changes take effect within about 1 minute (config cache).

File Attachments

Pro and Enterprise plans let visitors send files in the chat (a paperclip button appears in the toolbar):

TypeFormatsLimitWhat the AI does
Imagesjpg / png / webp5 MB (auto-compressed client-side)Sent to your model's vision capability — e.g. order screenshots. Requires a vision-capable model
Documentspdf / docx / xlsx / txt10 MBText is extracted and injected into the conversation context — works with any model
  • File sending is off by default — enable it per domain in Dashboard → Domains (Pro+ only). The paperclip button only appears after you turn it on.
  • One attachment per message; up to 10 uploads per visitor per hour.
  • Files are stored encrypted-at-rest on S3 with a 30-day lifecycle — expired files show a "File expired" placeholder in old chat history.
  • Enterprise live-chat supports two-way file transfer between visitors and agents, and tickets accept up to 3 attachments.

Webnav.ai — AI 智能客服