Documentation Index
Fetch the complete documentation index at: https://docs.firstflow.app/llms.txt
Use this file to discover all available pages before exploring further.
Installation
npm install @firstflow/react
Requirements: React 18+, TypeScript 4.7+ (optional but recommended)
Components
| Component | Description |
|---|
FirstflowProvider | Root provider. Fetches agent config and makes the SDK available to the tree. |
FirstflowWidget | Renders the active experience relative to your chat UI. |
Survey | Renders a specific survey outside the widget boundary. |
Hooks
| Hook | Description |
|---|
useFirstflow() | Returns the platform instance: setUser, reset, refreshConfig, analytics, survey. |
useFirstflowSurvey() | Headless survey state for custom survey UIs. |
Functions
| Function | Description |
|---|
createFirstflowApp(config) | Factory that returns a pre-configured provider wrapper component. |
Quick reference
import {
FirstflowProvider,
FirstflowWidget,
Survey,
useFirstflow,
useFirstflowSurvey,
createFirstflowApp,
} from "@firstflow/react";
UserContext
interface UserContext {
id: string;
email?: string;
name?: string;
traits?: Record<string, unknown>;
}
ExperienceUserPromptEvent
interface ExperienceUserPromptEvent {
experienceId: string;
nodeId: string;
prompt: string;
}