Skip to content

feat(crawl): get notified by webhook when a crawl starts, completes, stops or fails - #75

Merged
StefanoGuerrini merged 2 commits into
mainfrom
feat/crawl-webhooks
Oct 30, 2026
Merged

StefanoGuerrini merged 2 commits into
mainfrom
feat/crawl-webhooks

Conversation

@zenrows-dev-pool

@zenrows-dev-pool zenrows-dev-pool Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Crawls can now notify an endpoint when they start, complete, stop or fail, so callers no longer have to poll. This adds the webhook option on crawl creation and the webhook field on every returned crawl.

What the task asked for

Bring this surface in line with the Crawl API, which now accepts a webhook on POST /v1/crawls and sends signed zenrows.webhook/v1 events. zenrows crawl create gains --webhook <url>, --webhook-event <event> (repeatable) and --webhook-metadata key=value (repeatable). The printed crawl shows its webhook, and the crawl skill documents the flags and the signed events.

How the check confirmed it

  • npm run typecheck clean; npm test 498 passed, including the new flag and body tests.
  • Acceptance suite: 32 passed. Check 25 (Webhook) ran zenrows crawl create ... --webhook https://example.com/zenrows-hook --webhook-event crawl.completed --webhook-metadata k=v --json and read the same webhook back.
  • Public-text check: clean on the branch name, the commit and every added line.

How to try it

zenrows crawl create https://www.scrapingcourse.com/ecommerce/ --max-pages 1 \
  --webhook https://your-endpoint.example/hook --webhook-event crawl.completed --webhook-metadata site=shop

The output includes a webhook: line. The account needs a webhook signing key, created in the dashboard under Settings, API Keys.

Provenance

Repeatable flags follow --include-patterns; key=value follows batch --metadata, so the CLI sends metadata values as strings.

Review

One pass, the author's own checks above. No independent review ran.

Human must verify:

  • The names read naturally next to the rest of the crawl API in this package.
  • Merge only after the Crawl reference page lists webhook.

Deviations

  • Unit tests are in tests/, outside the three source paths, where the suite runs them.

Record owed

None.

…stops or fails

Crawls are long-running, and polling them until they end is the only way
the CLI lets a caller learn how one finished. The Crawl API now posts
signed events to a URL given at create, so the CLI can hand that URL, the
events to send and the metadata to echo back to the API, and shows the
webhook a crawl carries.
@StefanoGuerrini
StefanoGuerrini self-requested a review October 30, 2026 10:54
@StefanoGuerrini
StefanoGuerrini marked this pull request as ready for review October 30, 2026 10:54
@zenrows-dev-pool

zenrows-dev-pool Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

The node 20 check failed on "a wait never sleeps or retries past its --timeout" (sleeps: 2000,3000). That test is in the batch wait code, which this pull request does not touch, and it failed the same way on main before. #76 fixes the cause: the wait slept through a back-off ending exactly on the timeout. Once that merges, merging main into this branch or re-running the node 20 job makes this check green.

@StefanoGuerrini
StefanoGuerrini merged commit d71df97 into main Oct 30, 2026
3 checks passed
@StefanoGuerrini
StefanoGuerrini deleted the feat/crawl-webhooks branch October 30, 2026 11:16
@github-actions github-actions Bot mentioned this pull request Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant