1) Install the package
2) Embed Voicebox in your app
<Voicebox /> is the single component you embed. It renders a trigger button and the user-facing support widget for live voice support and cobrowse escalation.
Add it where you want in-app support to be available:
publishableKey comes from your Meridial dashboard. Use identifier to associate sessions with a specific user.
The
"use client" directive is required in Next.js App Router. In other React
setups (Vite, CRA, etc.) you can omit it.Props
| Prop | Description |
|---|---|
children | Custom content for the trigger button. Defaults to a “Help” label with an icon. |
publishableKey | Your Meridial publishable key. |
identifier | Optional identifier for the current user. Used to associate sessions with a specific user in the dashboard. |
baseUrl | Meridial API base URL. Defaults to the hosted service. |
firstMessage | The agent’s opening message when a session starts. |
instructions | System instructions that shape the agent’s behavior. |
metadata | Arbitrary key-value data attached to the session. Surfaces in the dashboard against the session record. Values must be strings. |
onError | Callback invoked when the widget encounters an error. Defaults to logging to the console. |
tools | Tools the agent can call during a session. See Agent tools below. |
sampleQuestions | Suggested prompts shown in the widget before a session starts. |
Custom trigger
Passchildren to replace the default trigger button content:
Agent tools
The SDK exportstool and useTool so the agent can perform actions in your app (navigate, fill forms, read state, and so on).
Define a tool with a Zod input schema and an execute handler:
Registering tools from child components
When a tool needs access to local component state (for example, a form on the current page), useuseTool instead of passing tools through Voicebox props:
useTool are merged with any tools passed to <Voicebox />. On key conflicts, hook-registered tools take precedence.