Workflow
When to use workflows and how they start.
Overview
Workflow guidance is integrated into the standard chat bubble, giving you step-by-step activation work, visible progress, and explicit handoff to the user.
When To Use It
- Use workflows when the customer is completing setup, activation, or first-value tasks.
- The chat bubble switches UI modes automatically when a workflow is active.
Workflows feel like a guided checklist inside the same AI bubble that supports freeform help.
Runtime Contract
To avoid replaying completed flows, pass stable user identity and eligibility fields into the provider.
import {
ModelNexProvider,
ModelNexChatBubble,
} from '@modelnex/sdk'
function AppShell() {
return (
<ModelNexProvider
websiteId="your-website-id"
userProfile={{
userId: currentUser.id,
type: currentUser.role,
isNewUser: currentUser.isNewUser,
features: currentUser.enabledFeatures,
}}
>
<Routes />
<ModelNexChatBubble appName="My Product" />
</ModelNexProvider>
)
}
userProfile.userIdscopes completion and dismissal state.userProfile.isNewUserpowersfirst_visitandreturn_visitmatching.userProfile.typeshould match the audiences you target in Portal.userProfile.featuresoruserProfile.tourFacts.featuresshould include any feature flags you use withfeature_unlockedflows.
first_visit matches when userProfile.isNewUser === true.
return_visit matches when userProfile.isNewUser === false.
feature_unlocked matches when the flow featureKey is present in userProfile.features or userProfile.tourFacts.features.
Resilience and Refreshes
ModelNex is designed to be resilient to page transitions and refreshes that occur during a workflow.
- Auto-resumption: If a user refreshes the page or navigates away, the SDK automatically re-establishes the connection and resumes the active workflow from the correct step.
- Benign re-evaluations: Technical disconnections (like those caused by a page reload) are handled as benign events. The agent re-verifies the user's current state against the goal before proceeding.
- Cross-type compatibility: While you can separate "Product Tours" from "Onboarding Workflows," the system allows seamless resumption across hook types if a session is already in progress.
Start Behavior
Choose a start behavior that matches how interruptive the workflow should be.
prompt_onlyopens the ModelNex chat bubble and asks the user in-chat before starting.immediate_startlaunches as soon as the trigger matches.manual_onlykeeps the flow available for explicit launch only, such as from a button or assistant command.
For most production workflows, prompt_only is the safest default because it respects user timing without hiding the activation path.
Customer-facing prompt_only activations now surface inside the chat bubble as a plain-language ask.
Blocking modals are reserved for review and preview flows that explicitly request modal presentation.
Testing
Test workflows deterministically with ?modelnex_test_workflow=FLOW_ID against staging environments that mirror production auth, flags, and routing.
- Validate that the panel persists across route transitions.
- Validate that user-waiting steps pause instead of forcing automation.
- Validate that completed users do not re-enter finished flows unexpectedly.
Continue with Workflow Authoring, then Workflow Preview and Publish.