Targeting Environments from the Widget
Pin a widget chat session to a specific agent environment using the versionAlias option.
Targeting Environments from the Widget
Every agent environment has an alias — a short, per-agent identifier you set when creating the environment. You can use this alias when embedding the widget to pin a session to that environment for its entire lifetime.
This is useful for:
- Staging or QA pages — serve a draft environment to internal testers without affecting production users.
- A/B testing your own setup — point different page variants at different environments to compare behavior manually.
- Developer preview links — embed a prototype link in an internal page for stakeholder review.
Note
The Publish → Copy prototype link action in the dashboard generates a shareable preview URL for a draft environment without requiring any SDK changes. Use versionAlias when you need programmatic control from your own embed.
How it works
When you pass versionAlias in the widget options, the widget frame routes all requests for that session to the matching environment. The alias is resolved at session start; if the alias does not exist, the widget falls back to the live Main environment.
The binding lasts for the lifetime of the session. Reloading the page starts a new session and resolves the alias again.
Usage
React
import { NexvioWidget } from "@nexvio-ai/widget-js/react"
export function StagingSupport() {
return (
<NexvioWidget
options={{
publicKey: "pk_...",
versionAlias: "staging-v2",
}}
/>
)
}
Floating launcher (React)
import { NexvioChatbot } from "@nexvio-ai/widget-js/react"
export function StagingChat() {
return (
<NexvioChatbot
options={{
publicKey: "pk_...",
versionAlias: "staging-v2",
position: "bottom-right",
}}
/>
)
}
Script tag
<script>
window.nexvioConfig = {
publicKey: "pk_...",
versionAlias: "staging-v2"
}
</script>
<script src="https://app.nexvio.ai/api/agent.js" async></script>
<nexvio-chat-bot></nexvio-chat-bot>
NexvioWidgetOptions reference
| Option | Type | Required | Description |
|---|---|---|---|
versionAlias | string | No | Alias of the environment to pin this session to. Omit to use the live Main environment. |
versionAlias is accepted by both <nexvio-agent> / <NexvioWidget> and <nexvio-chat-bot> / <NexvioChatbot>.
Finding an environment's alias
- Open your agent in the dashboard.
- Click Publish → View all environments.
- The Alias column shows the alias for each environment.
You can also view the alias when creating or inspecting an environment. See Agent Environments for the full guide.
Behavior notes
- If
versionAliaspoints to a draft environment, the session uses that draft for its full lifetime. - If the alias is not found on the agent, the session falls back silently to the live Main environment.
- The live Main environment has an alias too. You can pass it explicitly, but omitting
versionAliasis equivalent. versionAliasdoes not require any server-side changes — it is a client-side option passed at embed time.