Skip to main content

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

  1. Create an Edge Function (or HTTP endpoint) that accepts POST JSON.
  2. Verify header X-Lection-Secret against your expected secret.
  3. Read dataset.records and insert rows into your table; include run.status or download.url as needed.
  4. Deploy the function and copy the public URL.
  5. 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.

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.