# Changelog of Contact Scraper BR — Email, WhatsApp + Receita Federal (CNPJ) (`joaosbp/website-contact-finder-br`) Actor

- **URL**: https://apify.com/joaosbp/website-contact-finder-br/changelog.md
- **Full Actor documentation**: https://apify.com/joaosbp/website-contact-finder-br.md

## Changelog

### 0.2.0 — 2026-07-22

- **MAJOR: Receita Federal (CNPJ) enrichment.** The Actor now detects CNPJs on each website, validates the check digits (módulo 11) to eliminate false positives, and enriches via BrasilAPI with public Receita Federal data: razão social, nome fantasia, CNAE principal + descrição, porte, situação cadastral, município/UF, capital social.
- **New lead score.** `leadScore` (0–100) combines `contactScore` (0–75 points from contact channels) + company boost (0–25 points from porte, situação ATIVA, capital social, CNAE verification). Larger, active companies with verified data score higher.
- **New input flag `enrichCnpj`** (default: true). Disable to skip BrasilAPI lookups and reduce run time.
- **New CSV columns:** `cnpj`, `cnpj_formatted`, `razao_social`, `nome_fantasia`, `porte`, `situacao_receita`, `cnae_principal`, `municipio`, `uf`, `capital_social`, `lead_score`. One row now contains contact + company + score — ready to sort by `lead_score` and start calling.
- **New Dataset fields:** `cnpjs[]`, `primaryCnpj`, `company{}`, `leadScore`. New `company` view in the Console.
- **Graceful degradation.** BrasilAPI timeouts, 404s, or network failures never fail the run — the contact profile still ships without enrichment.
- **Per-run CNPJ cache.** Repeated CNPJs across websites (e.g., franchise chains) only hit BrasilAPI once.
- 20 new unit tests (CNPJ validation, extraction, normalization) + 9 integration tests (BrasilAPI real, lead score boost).

### 0.1.10 — 2026-07-22

- **NEW: CRM-ready CSV export.** Each run now saves `contacts.csv` in the Key-Value Store with one row per website and 26 stable columns (website, company\_name, email\_primary, phone\_primary, whatsapp\_primary, whatsapp\_link, social URLs, contact\_score, etc.). Import directly into Google Sheets, Excel, Pipedrive, HubSpot, or RD Station — no JSON parsing needed.
- CSV uses UTF-8 with BOM so Excel and Google Sheets auto-detect accented characters (São Paulo, Açaí, João) correctly.
- Output schema now exposes the CSV download link alongside the JSON dataset and OUTPUT summary.
- 9 new TDD tests covering flattening, CSV escaping, BOM, null handling, accented characters, and empty rows.

### 0.1.9

- Added opt-in same-origin contact-page discovery with a strict `maxSecondaryPages` budget.
- Merged and deduplicated contact channels into the primary website result instead of emitting extra rows.
- Added `secondaryPagesScanned`, `secondaryPageErrors`, and `secondaryPageUrls` to Dataset results and run summaries.
- Kept secondary-page failures isolated from otherwise successful primary profiles.
- Added TDD coverage for origin restrictions, limits, merging, and deduplication.

### 0.1.8

- Added operational `OUTPUT` counters for successful URLs, useful contact profiles, emails, phones, WhatsApp links, contact pages, forms, and social profiles.
- Defined `usefulProfiles` as successful results with at least one actionable contact signal (`contactScore > 0`).
- Added TDD coverage distinguishing technical success, useful profiles, and error items.

### 0.1.7

- Fixed the Actor lifecycle so fatal validation or startup errors preserve Apify run status `FAILED`.
- Kept `Actor.exit()` only on the successful completion path.
- Added regression coverage preventing `Actor.exit()` from returning to a fatal `finally` block.

### Documentation strategy update

- Added verified ten-site production evidence and HTTP-mode unit cost.
- Defined useful-row semantics so empty email lists are not confused with failed requests.
- Added CRM, automation, and agency buyer workflows.
- Added browser/proxy cost caveat and run-ID feedback instructions.

### 0.1.6

- Removed truncated email suffix false positives when a complete email is present on the same page.
- Added regression coverage based on the real `fidelidade@localiza.com` / `idelidade@localiza.com` case.
- Validated 10 Brazilian websites remotely: 10 useful rows, 0 errors, approximately $0.13 per 1,000 useful rows without browser/proxy.

### 0.1.5

- Simplified the Store input from 23 template-derived monitoring fields to 8 contact-finding controls.
- Kept safe runtime defaults for advanced snapshot and extraction behavior without exposing irrelevant UI complexity.
- Added an input-schema regression test to prevent template pollution from returning.
- Published the Actor and verified a two-website production smoke run.

### 0.1.4

- Revalidated Actor 15 as part of the focused 20-Actor Brazil B2B portfolio.
- Confirmed full local validation, local smoke, and dependency audit pass with 0 vulnerabilities.
- Republished remote build after comparing remote/local source and verifying no meaningful remote-only source changes.
- Verified remote smoke with a positive Brazilian contact profile and a generic control page.
- Updated Store listing evidence with build/run/dataset IDs and smoke outcomes.

### 0.1.3

- Audit hardening: redacted sensitive URL query parameters in propagated error messages.
- Reduced contact-page false positives by requiring contact-intent URL path segments or exact contact-intent anchor text.
- Added regression tests for contact-page classification and sensitive URL redaction.

### 0.1.1

- Added production contact extraction for emails, phones, WhatsApp links, contact pages, forms, and social profiles.
- Added contact completeness scoring and Apify Dataset schema views.
- Added TDD coverage for full contact extraction, false-positive filtering, deduplication, scoring, and snapshot integration.
- Hardened extraction against Sentry/error-reporting emails, naked numeric IDs, and WhatsApp links being misclassified as contact pages.

### 0.1.0

- Generated Website Contact Finder BR from the reusable Apify Actor factory.
- Added production project structure, schemas, README, commercial documentation, tests, Docker, CI workflow files, and validation scripts.
