Skip to content

fix(hunter): align tools, block, and outputs with Hunter.io v2 API spec#4511

Merged
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/validate-hunter-io
May 8, 2026
Merged

fix(hunter): align tools, block, and outputs with Hunter.io v2 API spec#4511
waleedlatif1 merged 2 commits intostagingfrom
waleedlatif1/validate-hunter-io

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Audit Hunter.io integration against v2 docs; remove phantom output fields and add missing ones across domain_search, email_finder, discover, companies_find
  • Fix discover response path (companies array, not data.data) and wrap headcount/company_type/technology in include arrays per docs
  • Flatten companies_find response, fix nested paths (category/metrics/geo/linkedin handle)
  • Mark optional filters as advanced mode; rename block to "Hunter.io"
  • Add transformResponse tests for all four tools

Type of Change

  • Bug fix

Testing

  • 11 unit tests covering transformResponse for domain_search, email_finder, discover, companies_find
  • Lint, typecheck, and api-validation pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 8, 2026 2:48am

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 8, 2026

PR Summary

Medium Risk
Changes the shape of several Hunter tool outputs (flattening/removing/renaming fields) and request parameter encoding, which may break existing workflows relying on the previous schema despite added tests.

Overview
Aligns the Hunter.io integration’s requests and response mappings to the v2 API spec, including fixing hunter_discover request body encoding and correcting response parsing/mapping for discover, domain_search, email_finder, and companies_find.

Updates the block/integration metadata (Hunter ioHunter.io), marks optional filters as advanced, adds pagination (offset) and safer param coercion, and refreshes the declared output schemas/types to match the new flattened/trimmed fields. Adds Vitest coverage for the updated transformResponse behavior across the four tools.

Reviewed by Cursor Bugbot for commit d5501d5. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 8, 2026

Greptile Summary

This PR audits the Hunter.io integration against the v2 API spec, removing phantom output fields, fixing response-path bugs, and aligning request body serialization across domain_search, email_finder, discover, and companies_find. It also adds 11 unit tests covering transformResponse for all four tools and marks optional UI filters as advanced mode.

  • discover.ts: fixes the body builder so headcount is sent as a plain array and company_type as { include: [...] }, and guards the response array with Array.isArray instead of relying on optional chaining.
  • companies_find.ts: flattens the nested Clearbit-backed shape (category.industry, geo.country, linkedin.handle, etc.) into a flat output and adds defensive employeesRange ?? String(employees) fallback.
  • domain_search.ts / email_finder.ts: removes fields that never existed in v2 (description, industry, social handles at org-level) and adds real v2 fields (linked_domains, position_raw, accept_all, linkedin_url, etc.).

Confidence Score: 5/5

Safe to merge — all changes are confined to the Hunter.io integration layer with no shared infrastructure touched.

The diff is a straightforward API-alignment pass: phantom output fields removed, real v2 fields added, response-path fixes backed by new unit tests. Type interfaces are updated consistently with the runtime transforms, null-safety is improved throughout, and the block UI changes are additive. No shared utilities, auth flows, or data-persistence paths are modified.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/tools/hunter/companies_find.ts Flattens nested company response (category, metrics, geo, linkedin/twitter/facebook handles) into a flat output; adds null-safe fallback chain for employeesRange → employees coercion
apps/sim/tools/hunter/discover.ts Fixes body serialization for headcount (plain array) and company_type ({ include: [...] }); guards response with Array.isArray; updates result shape to personal_emails/generic_emails/total_emails
apps/sim/tools/hunter/domain_search.ts Removes phantom org-level fields (description, industry, social handles, geo, technologies); adds linked_domains; replaces empty-string defaults with null for optional email fields
apps/sim/tools/hunter/email_finder.ts Adds missing fields (first_name, last_name, domain, accept_all, position, twitter, linkedin_url, phone_number, company) aligned to v2 API spec
apps/sim/tools/hunter/types.ts Updates TypeScript interfaces for HunterEmail, HunterDiscoverResult, HunterEmailFinderResponse, and HunterEnrichmentResponse to match v2 spec; removes unused COMPANY_OUTPUT and EMAILS_COUNT_OUTPUT exports
apps/sim/blocks/blocks/hunter.ts Renames block to Hunter.io, adds offset field, marks optional filters as advanced mode, adds headcount/company_type/technology dropdowns for discover, expands outputs to match all four tools' response shapes
apps/sim/tools/hunter/hunter.test.ts New test file: 11 unit tests covering transformResponse for domain_search, email_finder, discover, and companies_find including null defaults, safe fallbacks, and body-builder assertions

Reviews (2): Last reviewed commit: "fix(hunter): match documented Discover r..." | Re-trigger Greptile

Comment thread apps/sim/tools/hunter/companies_find.ts Outdated
Comment thread apps/sim/tools/hunter/discover.ts Outdated
@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d5501d5. Configure here.

@waleedlatif1 waleedlatif1 merged commit 235a62f into staging May 8, 2026
14 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/validate-hunter-io branch May 8, 2026 03:01
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