Skip to main content

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

ComponentDescription
FirstflowProviderRoot provider. Fetches agent config and makes the SDK available to the tree.
FirstflowWidgetRenders the active experience relative to your chat UI.
SurveyRenders a specific survey outside the widget boundary.

Hooks

HookDescription
useFirstflow()Returns the platform instance: setUser, reset, refreshConfig, analytics, survey.
useFirstflowSurvey()Headless survey state for custom survey UIs.

Functions

FunctionDescription
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;
}