Tutorials / Webhook Integrations / Supabase Edge Function
Supabase Edge Function
Receive Lection webhooks on an Edge Function and write to your Supabase tables.
Ideal for: Direct database writes with full control.
Setup Steps
- Create an Edge Function (or HTTP endpoint) that accepts POST JSON.
- Verify header X-Lection-Secret against your expected secret.
- Read dataset.records and insert rows into your table; include run.status or download.url as needed.
- Deploy the function and copy the public URL.
- Set Lection webhook URL to the function URL, set the same secret, and run a test scrape.
Mapping Tips
- dataset.records is an array of objects keyed by dataset.columns; insert as-is or reshape.
- download.url is a time-limited link to the export file.
- Keep the handler fast (<12s) or respond 200 and process asynchronously.
Payload highlights
- POST JSON with event scheduled_scrape.completed and version 1.
- Headers: Content-Type: application/json; optional X-Lection-Secret.
Helpful links
Test checklist
- Set webhook URL and optional secret in Lection.
- Run a scheduled scrape to capture sample data.
- Confirm dataset.records and download.url arrive in your tool.
- Publish/activate the workflow so production runs stay wired.