Web & WordPressWeb Deployment·6 min read

Website Widget & WordPress Plugin

Deploy per-agent chat widgets across custom HTML sites, Next.js App Router, Shopify, Webflow, or WordPress using the official servunio-ai-chat plugin, domain allowlists, and local branding cache.

Section 01

Per-agent embed tokens

Each AI assistant in Servunio generates its own scoped WIDGET_EMBED deployment token (passed via the data-token attribute). This lets you run different assistants—each with distinct branding, knowledge scope, and capabilities—on different websites, storefronts, or landing pages.

You can copy the token or full embed snippet from Dashboard -> Settings -> Integrations or directly from your agent's deployment settings.

HTML5 — Standard Script Tag
html
<script
  src="https://servunio.com/widget/servunio-widget.js"
  data-token="YOUR_AGENT_DEPLOYMENT_TOKEN"
  defer
></script>
Section 02

Next.js, Shopify & Webflow installation

The Servunio widget script loads asynchronously with defer and mounts inside an isolated UI container so it never collides with your site's CSS rules. Follow the placement conventions for your frontend stack:

  • Next.js (App Router): Render next/script with strategy="afterInteractive" inside your RootLayout <body>.
  • Shopify: Open Online Store -> Themes -> Edit Code -> layout/theme.liquid and paste the <script> tag right before </body>.
  • Webflow: Open Site Settings -> Custom Code -> Footer Code, paste the <script> tag, save, and publish your site.
app/layout.tsx — Next.js App Router
tsx
import Script from "next/script";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        {children}
        <Script
          src="https://servunio.com/widget/servunio-widget.js"
          data-token={process.env.NEXT_PUBLIC_SERVUNIO_TOKEN}
          strategy="afterInteractive"
        />
      </body>
    </html>
  );
}
Section 03

Official servunio-ai-chat WordPress plugin

For WordPress sites, install the official servunio-ai-chat plugin instead of editing theme templates manually. Because it hooks cleanly into WordPress script output, theme updates will never overwrite your widget setup.

Download the servunio-ai-chat plugin archive from your Servunio Dashboard, then upload it in WordPress Admin under Plugins -> Add New -> Upload Plugin (or extract the servunio-ai folder into /wp-content/plugins/).

  • Activate the plugin and open Settings -> Servunio AI Chat (options-general.php?page=servunio-ai-chat).
  • Paste your deployment token (or the full embed snippet—the settings handler automatically extracts the data-token value).
  • Save changes; the plugin automatically injects servunio-widget.js with defer across your storefront or blog.
Customize script URL via WordPress filter

WordPress developers can override the default widget script origin using the servunio_ai_chat_widget_url filter hook if routing through a custom proxy.

Section 04

Domain allowlists & widget branding cache

Protect your deployment token from unauthorized embeds by configuring Allowed Domains in your workspace settings. Servunio validates incoming widget origins against your normalized domain allowlist before serving sessions.

On page load, the widget reads cached visual branding from browser localStorage (keyed per token under servunio_widget_branding_*) for instant first-paint styling, while concurrently fetching fresh tenant configuration with Cache-Control: no-cache so color, greeting, and capability updates appear immediately.

Next Recommended Step

Train your assistant with Knowledge & Auto Crawler

Index your documentation, service pages, PDFs, and FAQs with Shared or Agent-Only scoping.