Skip to content

Supabase RPC

Use Supabase RPC to start pgflow workflows with simple function calls when you don’t need real-time progress updates.

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 workflow
const { 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);
}

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);