Skip to content

Features

Mcdavid Obioha edited this page Dec 2, 2026 · 1 revision

Features

Everything whatsapp-chat-widget-react does, as of v0.8.0, with a link to the page that documents each part. Every feature is optional and off by default unless marked default.

Core

Docs: Getting Started · Props Reference

  • Floating launcher and contact form. A button opens a name, subject and message form. Default.
  • WhatsApp handoff, no backend. The draft opens in WhatsApp through https://wa.me/<number>?text=.... No API key, server or account needed. Default.
  • Phone number validation. International format, 7 to 15 digits, optional +. An invalid number disables sending and shows a notice.
  • Custom message template. messageTemplate(details) controls the exact text sent to WhatsApp.
  • Configurable form. Hide the name or subject field with fields, pre-fill with defaultMessage, rename the title, hint, button and submit text.
  • Zero runtime dependencies. React is a peer dependency (18 or 19). ESM only. TypeScript types included. Client component ("use client").

Appearance

Docs: Styling and Theming · Right-to-Left and Translations

  • Variants and sizes. variant: pill or icon. size: sm, md, lg.
  • Themes. green, brand, light, dark, and auto (the panel follows the visitor's light or dark setting).
  • Accent color. accentColor takes any CSS color.
  • CSS variables. --wa-primary, --wa-bg, --wa-text, --wa-radius, --wa-z-index.
  • Position and offset. bottom-right, bottom-left, and the direction-aware bottom-end and bottom-start. offset sets the distance from the edges.
  • Greeting bubble and notification dot. greeting shows a bubble over the closed launcher. showNotificationDot shows a dot until the first open.
  • Right-to-left support. dir="rtl" or auto. Styles use CSS logical properties.
  • Style control. className and style on the root. injectStyles={false} plus import 'whatsapp-chat-widget-react/styles.css' to load the CSS yourself.
  • Translations. labels overrides every built-in string.

Teams and hours

Docs: Agents and Business Hours

  • Multiple agents. agents shows an accessible picker with avatars or initials. The chat opens with the selected agent's number. One agent needs no picker.
  • Business hours. businessHours is timezone-aware (built on Intl.DateTimeFormat, no date library) and shows Online or Offline. Per-agent hours are supported.
  • Offline behavior. A custom offline message, and allowOfflineMessages: false to block sending outside hours.
  • Smart default agent. The first agent who is online is preselected.

Page context and attribution

Docs: Page Context and Attribution

  • Page context. includePageContext appends the page title, URL (without query or hash), UTM source, medium and campaign, and optionally the referrer to the message. Control characters are stripped.
  • Privacy by default. Query strings and hashes are never included, so tokens in URLs do not leak.

When it shows

Docs: Controlling the Widget

  • Delayed reveal. showAfter waits a number of milliseconds, a scroll percentage, or both.
  • Path rules. hideOnPaths hides the widget on matching paths (* wildcard) and follows client-side navigation.
  • Force hide. hidden.
  • Controlled or uncontrolled open state. isOpen, defaultOpen, onOpenChange, onOpen, onClose.

Live in-widget chat (v0.8)

Docs: Live Chat · Backend Recipes

  • Pluggable transport. transport="handoff" (default) or a WhatsAppTransportAdapter with mode: "live".
  • Conversation view. After the pre-chat form the panel becomes a role="log" thread with aria-live="polite", a composer (Enter sends, Shift+Enter adds a line), and a delivery status on every message (Sending, Sent, Delivered, Not sent with Retry).
  • Session persistence. The conversation survives a page reload through sessionStorage, keyed by widgetId. "End chat" clears it.
  • Continue on WhatsApp. A button in the live view hands the whole transcript to wa.me at any time.
  • createWebhookTransport (from whatsapp-chat-widget-react/adapters). A ready adapter for n8n, Make, Zapier or a WhatsApp Cloud API proxy: { sendUrl, pollUrl?, pollIntervalMs?, headers? }. Polling de-duplicates replies and pauses while the tab is hidden.
  • Retry and failure handling. Failed sends are marked and can be retried. A message left "sending" at reload is shown as failed.

Bring your own AI (v0.8)

Docs: Bring Your Own AI · Backend Recipes

  • No SDKs, no keys. The widget only calls functions you provide.
  • Polish with AI. ai.polishMessage(draft, pageContext) adds a button once the visitor has typed 10 characters, with a loading state and an Undo that restores their own words. Failures leave the text unchanged.
  • createOpenAICompatibleAI. From whatsapp-chat-widget-react/adapters: connects ai to any /v1/chat/completions endpoint (OpenAI, Claude through OpenRouter or LiteLLM, Cloudflare AI Gateway, Groq, Ollama) with endpoint, model, headers, systemPrompt and enableRouting. Point it at your own proxy; the docs include copy-paste ones.
  • Private by design. The triage payload carries agent id, name and role only, never phone numbers.
  • Auto-routing. ai.routeAndTriage(...) can return suggestedAgentId. A matching agent is selected and a "Routed to Support" badge is shown.
  • Instant replies. If instantReply is returned, it is shown with "That solved it" and "Still need a human on WhatsApp". onDeflection reports the choice.
  • Refined messages. refinedMessage replaces the text that is sent.
  • Fails open. If your function throws, the visitor is sent through unchanged.

Lead capture (v0.8)

Docs: Lead Webhooks

  • Non-blocking webhook. webhookUrl sends name, subject, message, selectedAgent, pageContext, utm and timestamp as JSON using navigator.sendBeacon, falling back to fetch with keepalive. It completes even while the page moves to WhatsApp.
  • Never blocks the visitor. Webhook failures are silent.
  • onBeforeHandoff. Runs before WhatsApp opens. An async callback is awaited for up to 1.5 seconds; its errors are ignored.
  • No phone numbers in payloads. selectedAgent carries only id, name and role.
  • Popup-blocker safe. With no async steps, WhatsApp opens synchronously on submit. If an async step used up the browser's click activation, an "Open WhatsApp" button appears instead of a blocked popup.

Control from your code (v0.8)

Docs: Widget Hook and Provider

  • WhatsAppWidgetProvider and useWhatsAppWidget(). { isOpen, open, close, toggle, openWithDraft }.
  • openWithDraft({ name?, subject?, message?, agentId? }). Opens the widget, fills the fields, selects the agent and focuses the first empty field. Calls made before the widget is visible run when it appears.
  • Optional. <WhatsAppChat /> works without the provider.
  • Tree-shakeable. The provider adds under 0.5 kB, createWebhookTransport 0.7 kB and createOpenAICompatibleAI 1.2 kB, only when imported.

Without React: the script-tag build (v0.7)

Docs: Script-Tag Build

  • One file. dist/standalone.global.js, from unpkg or jsDelivr, no dependencies. Works on plain HTML, WordPress, Webflow, Shopify and Squarespace.
  • No JavaScript needed. Configure with data-* attributes (data-phone, data-theme, ...), JSON for objects (data-agents), or one data-config object.
  • Global API. WhatsAppChatWidget.init(config), open(), close(), toggle(), openWithDraft(), destroy() and the isOpen property.
  • Style isolation. Renders in a Shadow DOM by default so site CSS cannot break it. shadowDom: false opts out, with a duplicate-safe style tag.
  • Same widget. Identical markup and styles as the React component, with a test that compares the two.
  • Also supported: agents, business hours, page context, showAfter, deepLink (whatsapp://send), onSubmit, webhookUrl, onBeforeHandoff.
  • Also in the script build: ai (with WhatsAppChatWidget.createOpenAICompatibleAI) and onDeflection.
  • Not yet in the script build: transport (live chat).

Accessibility

Docs: Accessibility

  • Keyboard operable end to end. Escape closes and returns focus to the launcher. Focus moves into the form on open.
  • Real labels, aria-expanded and aria-controls on the launcher, role="alert" and role="status" for messages, a named role="log" for live chat.
  • Built-in themes meet WCAG AA contrast, checked by script. Status is always text, never only a color.
  • axe-core runs in the test suite on the form, live chat, AI toolbar and instant reply.

Server rendering

Docs: Framework Guides

  • A client component ("use client"). Business hours and page context are computed after mount, so server and client markup match and there are no hydration warnings.
  • Follows client-side navigation for hideOnPaths.

For AI assistants and tooling

  • llms.txt and AGENTS.md describe the API for coding assistants.
  • props.schema.json is generated from the TSDoc on the props, so it cannot drift from the code.
  • Complete TypeScript types for every prop, callback payload and adapter.

Quality

  • 126 tests (Vitest, Testing Library, jsdom, node:test), including a React-versus-script DOM parity check.
  • Size budgets in CI with size-limit, per entry point.
  • Provenance. Published from GitHub Actions through npm trusted publishing, with a provenance statement.
  • Subresource Integrity hashes documented for the CDN build.
  • Backend recipes in docs/ai-and-webhooks.md: Claude and OpenAI proxies for Next.js and Cloudflare Workers, plus n8n and WhatsApp Cloud API setup.
  • MIT licensed.

Not included (on purpose)

  • No built-in LLM, no API keys, no hosted backend. Live chat and AI call your endpoints.
  • No tracking or cookies. Live chat uses sessionStorage only, and only when you enable it.
  • No phone numbers in webhook payloads.

Clone this wiki locally