Skip to main content

Tutorials / Webhook Integrations / Custom Webhook Endpoint

Custom Webhook Endpoint

Point Lection at any HTTPS endpoint you own and handle the payload yourself.

Ideal for: Full control with your own auth and processing.

Setup Steps

  1. Expose an HTTPS POST endpoint that responds quickly (aim <12s) and returns 2xx.
  2. Validate the header X-Lection-Secret against an environment variable.
  3. Read dataset.records (array of row objects) and store or forward as needed.
  4. Optionally enqueue heavy work and return 200 immediately; include download.url in downstream steps.
  5. Set the endpoint URL and secret in Lection and run a test scrape.

Mapping Tips

  • dataset.columns provides header order; dataset.records are keyed by those headers.
  • download.url is time-limited; fetch or relay it quickly if you need the file.
  • Do not rely on retries here—handle idempotency yourself if needed.

Payload highlights

  • event: scheduled_scrape.completed, version: 1.
  • schedule.*, run.*, dataset.*, download.* objects as described.
  • Headers: Content-Type: application/json and 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.