Skip to content

fix(js-sdk): add webhook option to startExtract and extract methods#3318

Open
jaydeep-pipaliya wants to merge 1 commit intofirecrawl:mainfrom
jaydeep-pipaliya:fix/extract-webhook-types
Open

fix(js-sdk): add webhook option to startExtract and extract methods#3318
jaydeep-pipaliya wants to merge 1 commit intofirecrawl:mainfrom
jaydeep-pipaliya:fix/extract-webhook-types

Conversation

@jaydeep-pipaliya
Copy link
Copy Markdown

@jaydeep-pipaliya jaydeep-pipaliya commented Apr 8, 2026

Summary

Fixes #2582.

The startExtract and extract methods in the v2 JS SDK did not accept webhook configuration in their TypeScript type definitions, even though the Firecrawl API supports webhooks for extract jobs and other async methods (crawl, batchScrape) already include it.

  • Added webhook?: string | WebhookConfig | null to prepareExtractPayload() parameter type
  • Forward webhook to the request body, matching the pattern used in crawl.ts (line 39) and batch.ts (line 37)
  • Types flow automatically to startExtract() and extract() via Parameters<typeof prepareExtractPayload>[0]

Usage after fix:

const result = await firecrawl.startExtract({
  urls: ['https://example.com'],
  schema: mySchema,
  prompt: 'Extract data',
  webhook: {
    url: 'https://example.com/webhook',
    metadata: { jobId: '123' },
    events: ['completed', 'failed'],
  },
});

Test plan

  • Verified type signature matches CrawlOptions.webhook and BatchScrapeOptions.webhook patterns
  • Verified webhook is forwarded to request body using the same if (args.webhook != null) guard as crawl.ts and batch.ts

Summary by cubic

Adds webhook support to startExtract and extract in the v2 firecrawl JS SDK so extract jobs can send callbacks. Aligns extract with crawl and batchScrape.

  • Bug Fixes
    • Accepts webhook?: string | WebhookConfig | null in prepareExtractPayload, flowing to startExtract/extract.
    • Forwards webhook to the request body when provided.

Written for commit a49b967. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

The startExtract and extract methods in the v2 JS SDK did not accept
webhook configuration, despite the API supporting it and other async
methods (crawl, batchScrape) already including it.

Add webhook?: string | WebhookConfig | null to prepareExtractPayload
and forward it to the request body, matching the pattern used in
crawl and batchScrape.

Fixes firecrawl#2582
@jaydeep-pipaliya jaydeep-pipaliya force-pushed the fix/extract-webhook-types branch from a80af56 to a49b967 Compare April 8, 2026 11:54
@jaydeep-pipaliya
Copy link
Copy Markdown
Author

Gentle ping — this adds webhook support to the extract methods in the JS SDK (mirrors the existing webhook option on crawl/scrape). Happy to address any feedback!

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.

[Bug] The startExtract method in the Node.js SDK does not accept webhook options

1 participant