Repository navigation
feat(crawl): get notified by webhook when a crawl starts, completes, stops or fails - #72
Merged
Merged
Conversation
…stops or fails The Crawl API now accepts a webhook on create and sends signed events to it, so a caller no longer has to poll to learn when a crawl ends. create() takes webhook= (url, events, metadata), every returned crawl carries the webhook it runs with as Crawl.webhook, CrawlWebhookEvent models the event body, and zenrows.crawl exposes verify_webhook_signature() to check an event's X-Signature header with the account's webhook signing key.
StefanoGuerrini
marked this pull request as ready for review
October 30, 2026 10:37
StefanoGuerrini
self-requested a review
October 30, 2026 10:49
StefanoGuerrini
approved these changes
Oct 30, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Crawls can now notify an endpoint when they start, complete, stop or fail, so callers no longer have to poll. This adds the
webhookoption on crawl creation and thewebhookfield on every returned crawl.What the task asked for
Bring this surface in line with the Crawl API, which now accepts a
webhookonPOST /v1/crawlsand sends signedzenrows.webhook/v1events.ZenRowsCrawlClient.create(..., webhook=...)takes aurl, optionaleventsand optionalmetadata. Every returned crawl carriesCrawl.webhook.CrawlWebhookEventmodels an event body, andzenrows.crawlexposesverify_webhook_signatureto check theX-Signatureheader.How the check confirmed it
make check(ty, ruff check, ruff format) clean;uv run pytest311 passed, 7 of them new.{"url":"https://example.com/zenrows-hook","events":["crawl.completed"],"metadata":{"k":"v"}}.How to try it
The crawl prints the webhook back. The account needs a webhook signing key, created in the dashboard under Settings, API Keys.
Provenance
Follows the module's existing TypedDict request options and open enums for response values. The signature check re-exports the helper the library already ships for Batch, since the scheme and key are the same.
Review
One pass, the author's own checks above. No independent review ran.
Human must verify:
webhook.Deviations
README.md(outside the crawl package) gains a short "Get notified by webhook" section, because this repository documents crawl options there.tests/test_crawl_client.py, outside the crawl package, where the suite runs them.Record owed
None.