Overview
Technical reference for Workflow Builder React components, hooks, and types in the FW core.React Components
WorkflowCanvas
Visual canvas for designing workflows with React Flow.nodes: Node[]- Array of workflow nodesedges: Edge[]- Array of connections between nodesonNodesChange: (changes: NodeChange[]) => void- Node state changesonEdgesChange: (changes: EdgeChange[]) => void- Edge state changesonNodeClick?: (event: React.MouseEvent, node: Node) => void- Node click handleronPaneClick?: () => void- Canvas click handleronDrop?: (event: React.DragEvent) => void- Node drop handleronDragOver?: (event: React.DragEvent) => void- Drag over handler
NodePalette
Sidebar with draggable node types.- Categorized node groups (Triggers, Actions, Control Flow, etc.)
- Drag-to-add interface
- Search/filter capability
- Collapsible categories
NodePropertiesPanel
Configuration panel for selected node.selectedNode: Node | null- Currently selected nodeonNodeUpdate: (nodeId: string, data: any) => void- Update handleronDeleteNode: (nodeId: string) => void- Delete handler
ExecutionTrace
Timeline visualization of workflow execution.executionId: string- Execution record IDexecution: WorkflowExecution- Execution data with node states
WorkflowValidation
Pre-execution validation and error display.nodes: Node[]- Workflow nodes to validateedges: Edge[]- Workflow edges to validateonValidate?: (result: ValidationResult) => void- Validation callback
ErrorDisplay
Error presentation component.error: WorkflowError | string- Error to displayvariant?: 'inline' | 'card'- Display style (default: ‘inline’)
React Hooks
useWorkflowDefinition
Fetch and save workflow canvas state.ruleId: string- Automation rule ID
definition: WorkflowDefinition | null- Current canvas stateisLoading: boolean- Loading stateisSaving: boolean- Saving statesaveDefinition: (nodes, edges, viewport?) => Promise<void>- Save function
useWorkflowExecution
Manage workflow execution state.executionId: string- Execution record ID
execution: WorkflowExecution | null- Execution dataisLoading: boolean- Loading statepauseExecution: () => Promise<void>- Pause functionresumeExecution: () => Promise<void>- Resume functioncancelExecution: () => Promise<void>- Cancel function
useWorkflowApprovals
Fetch and manage approval tasks.organizationId: string- Organization ID
approvals: WorkflowApproval[]- Pending approvalsisLoading: boolean- Loading stateapproveTask: (id, notes?) => Promise<void>- Approve functionrejectTask: (id, notes?) => Promise<void>- Reject function
useSubflows
Manage reusable subflows.organizationId: string- Organization ID
subflows: Subflow[]- Available subflowsisLoading: boolean- Loading statecreateSubflow: (data) => Promise<void>- Create functionupdateSubflow: (id, data) => Promise<void>- Update functiondeleteSubflow: (id) => Promise<void>- Delete function
useExecutionTrace
Fetch real-time execution trace.executionId: string | null- Execution record ID
- React Query result with
executiondata - Auto-polling while execution status is ‘running’ or ‘paused’
useWorkflowVersions
Manage workflow version history, rollback, and comparison.ruleId: string | undefined- Automation rule ID
versions: WorkflowVersion[]- All versions for the rule (newest first)isLoading: boolean- Loading state for initial fetcherror: Error | null- Error stategetVersion: (version: number) => Promise<WorkflowVersion | null>- Fetch specific versioncreateVersion: (options: CreateVersionOptions) => Promise<number>- Create new version snapshotisCreatingVersion: boolean- Creating version loading staterollback: (options: RollbackOptions) => Promise<void>- Rollback to previous versionisRollingBack: boolean- Rollback loading statecompareVersions: (versionA: number, versionB: number) => Promise<VersionDiff>- Compare two versions
TypeScript Types
Node Types
Workflow Execution Types
Subflow Types
Edge Function API
POST /automation-executor
Execute workflow based on trigger data. Endpoint:https://{project-ref}.supabase.co/functions/v1/automation-executor
Headers:
Database Schema
fw_workflow_definitions
fw_workflow_executions
fw_subflows
Examples
Creating a Simple Workflow Programmatically
Triggering a Workflow
Monitoring Execution
Best Practices
Performance
- Keep workflows under 50 nodes for optimal performance
- Use parallel execution for independent actions
- Set reasonable
maxIterationson loops - Lazy load node configuration forms
Error Handling
- Always validate workflows before execution
- Provide default/else paths in branches
- Set timeouts on approval nodes
- Use try-catch in custom functions
Security
- Validate all user inputs
- Use RLS policies on all tables
- Sanitize dynamic values in emails/webhooks
- Audit approval decisions
Maintainability
- Use descriptive node labels
- Extract reusable logic into subflows
- Document complex workflows
- Version control workflow definitions
Support
For additional API documentation and support:- Review workflow examples in
workflow-examples.md - Check the user guide in
workflow-builder-guide.md - Contact technical support for assistance