Supabase RPC
Use Supabase RPC to start pgflow workflows with simple function calls when you don’t need real-time progress updates.
Basic Usage
Section titled “Basic Usage”Start a workflow by calling the pgflow.start_flow function via RPC:
import { createClient } from '@supabase/supabase-js';
const supabase = createClient( 'https://your-project.supabase.co', 'your-anon-key');
// Start a workflowconst { data, error } = await supabase .schema('pgflow') .rpc('start_flow', { flow_slug: 'send_welcome_email', input: { name: 'John Doe' } });
if (error) { console.error('Failed to start workflow:', error);} else { console.log('Workflow started with run_id:', data);}With Custom Run ID
Section titled “With Custom Run ID”Provide a custom UUID for the workflow run:
import { randomUUID } from 'crypto';
const run_id = randomUUID();
const { data, error } = await supabase .schema('pgflow') .rpc('start_flow', { flow_slug: 'process_upload', input: { file_url: 'https://example.com/file.pdf' }, run_id: run_id });
console.log('Started workflow:', run_id);Learn More
Section titled “Learn More” TypeScript Client Use the full client library for real-time progress streaming