# Construction Subcontractor Leads (SERP + IA) (`deep_zinc/leads-construccion-wa`) Actor

Busca oportunidades de subcontratación de construcción en Google (vía apify/google-search-scraper), las estructura con IA y guarda leads limpios en el dataset.

- **URL**: https://apify.com/deep\_zinc/leads-construccion-wa.md
- **Developed by:** [Andre Figueroa](https://apify.com/deep_zinc) (community)
- **Categories:** AI, Lead generation
- **Stats:** 1 total users, 1 monthly users, 54.5% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Actor Apify: Leads de subcontratación de construcción (WA)

SERP de Google → extracción con IA → dataset de leads estructurados.

### Cómo subirlo a Apify

```bash
npm install -g apify-cli
apify login
cd apify-actor-leads-construccion
apify push
```

Luego en la consola de Apify: pega tu `openaiApiKey` en el input (campo secreto), ajusta las queries y ejecuta. Puedes programarlo (Schedules) para correr diario/semanal y conectar el dataset a Google Sheets, Airtable o webhook de n8n/Make.

### Input

- `queries`: una búsqueda por línea (usa las comillas de Google para frases exactas).
- `maxPagesPerQuery`: páginas de resultados por query (default 2).
- `openaiApiKey`: clave de OpenAI (secreta).
- `model`: default `gpt-4o-mini`.
- `minRelevancia`: filtra leads (`baja` = todos).
- `soloWashington`: descarta falsos positivos (Washington DC, UK, PA…).

### Output (dataset)

Campos por lead: `tipo_de_trabajo`, `es_proyecto_residencial`, `ubicacion`, `es_estado_washington`, `nombre_contacto_o_empresa`, `telefono`, `email`, `descripcion_corta`, `urgente`, `tipo_oportunidad`, `tarifa_o_pago`, `requisitos`, `fecha_publicacion`, `relevancia`, `fuente`, `url`, `fecha_serp`, `query_origen`.

### Notas

- El costo del SERP lo cobra `apify/google-search-scraper` (actor oficial); la extracción usa tu clave de OpenAI (~$0.01 por 100 resultados con gpt-4o-mini).
- Los snippets de Google casi nunca traen teléfono/email. Para enriquecer: segunda etapa que visite las URLs que NO sean Facebook/Instagram (esas requieren login y su scraping viola sus ToS — usa los actores de Apify especializados si lo necesitas).
- Deduplica por URL entre corridas guardando las URLs vistas en un Key-Value Store si lo corres programado (mejora fácil de agregar).

# Actor input Schema

## `baseUrl` (type: `string`):

Escribe un atajo: gemini, groq, deepseek, openrouter u openai. (También acepta una URL completa de cualquier API compatible con OpenAI). Déjalo vacío para usar OpenAI. RECOMENDADO: gemini — tiene capa gratis de 1,500 peticiones al día.

## `model` (type: `string`):

Debe existir en el proveedor que elegiste arriba. Con gemini: gemini-2.5-flash. Con openai: gpt-4o-mini. Con groq: llama-3.3-70b-versatile. Con deepseek: deepseek-chat.

## `openaiApiKey` (type: `string`):

La llave del proveedor que pusiste arriba, NO necesariamente de OpenAI. Si elegiste gemini, va tu llave de Google AI Studio (aistudio.google.com/apikey).

## `serpDatasetId` (type: `string`):

Si ya corriste apify/google-search-scraper por separado, pega aquí el ID de su dataset y se reprocesa sin volver a pagar el SERP. Puedes pegar el ID o la URL completa. Si lo llenas, las queries de abajo se ignoran.

## `queries` (type: `string`):

Una búsqueda por línea. Cada línea se envía como término a apify/google-search-scraper.

## `maxPagesPerQuery` (type: `integer`):

Cuántas páginas de resultados de Google traer por búsqueda. Más páginas = más leads pero más costo de SERP.

## `minRelevancia` (type: `string`):

Filtra los leads por el nivel de relevancia que les asigna la IA. 'Todas' no descarta nada.

## `soloWashington` (type: `boolean`):

Descarta leads fuera del estado de WA (Washington DC, UK, otros estados).

## Actor input object example

```json
{
  "baseUrl": "gemini",
  "model": "gemini-2.5-flash",
  "queries": "\"seeking subcontractors\" \"custom home\" OR \"remodel\" \"Washington\"\n\"roofing subcontractor needed\" OR \"roofing crew wanted\" \"Washington\"\n\"looking for framing crew\" OR \"framing subcontractor needed\" \"WA\"\n\"drywall subcontractor needed\" OR \"drywall crew wanted\" \"King County\" OR \"Snohomish\"\n\"subcontractors wanted\" \"residential\" \"Seattle\" OR \"Tacoma\" OR \"Bellevue\"\n\"subcontractor opportunities\" \"residential\" \"Washington state\"",
  "maxPagesPerQuery": 2,
  "minRelevancia": "baja",
  "soloWashington": true
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "baseUrl": "gemini",
    "model": "gemini-2.5-flash",
    "serpDatasetId": "",
    "queries": `"seeking subcontractors" "custom home" OR "remodel" "Washington"
"roofing subcontractor needed" OR "roofing crew wanted" "Washington"
"looking for framing crew" OR "framing subcontractor needed" "WA"
"drywall subcontractor needed" OR "drywall crew wanted" "King County" OR "Snohomish"
"subcontractors wanted" "residential" "Seattle" OR "Tacoma" OR "Bellevue"
"subcontractor opportunities" "residential" "Washington state"`
};

// Run the Actor and wait for it to finish
const run = await client.actor("deep_zinc/leads-construccion-wa").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "baseUrl": "gemini",
    "model": "gemini-2.5-flash",
    "serpDatasetId": "",
    "queries": """\"seeking subcontractors\" \"custom home\" OR \"remodel\" \"Washington\"
\"roofing subcontractor needed\" OR \"roofing crew wanted\" \"Washington\"
\"looking for framing crew\" OR \"framing subcontractor needed\" \"WA\"
\"drywall subcontractor needed\" OR \"drywall crew wanted\" \"King County\" OR \"Snohomish\"
\"subcontractors wanted\" \"residential\" \"Seattle\" OR \"Tacoma\" OR \"Bellevue\"
\"subcontractor opportunities\" \"residential\" \"Washington state\"""",
}

# Run the Actor and wait for it to finish
run = client.actor("deep_zinc/leads-construccion-wa").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "baseUrl": "gemini",
  "model": "gemini-2.5-flash",
  "serpDatasetId": "",
  "queries": "\\"seeking subcontractors\\" \\"custom home\\" OR \\"remodel\\" \\"Washington\\"\\n\\"roofing subcontractor needed\\" OR \\"roofing crew wanted\\" \\"Washington\\"\\n\\"looking for framing crew\\" OR \\"framing subcontractor needed\\" \\"WA\\"\\n\\"drywall subcontractor needed\\" OR \\"drywall crew wanted\\" \\"King County\\" OR \\"Snohomish\\"\\n\\"subcontractors wanted\\" \\"residential\\" \\"Seattle\\" OR \\"Tacoma\\" OR \\"Bellevue\\"\\n\\"subcontractor opportunities\\" \\"residential\\" \\"Washington state\\""
}' |
apify call deep_zinc/leads-construccion-wa --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,deep_zinc/leads-construccion-wa"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/TjhMWf7k2yBWa9cxz/builds/fxea9az4dAVIM2MNU/openapi.json
