d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
133 lines
4.2 KiB
TypeScript
133 lines
4.2 KiB
TypeScript
import type { HunterEmailFinderParams, HunterEmailFinderResponse } from '@/tools/hunter/types'
|
|
import {
|
|
HUNTER_API_KEY_PREFIX,
|
|
HUNTER_SEARCH_CREDIT_USD,
|
|
SOURCES_OUTPUT,
|
|
VERIFICATION_OUTPUT,
|
|
} from '@/tools/hunter/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const emailFinderTool: ToolConfig<HunterEmailFinderParams, HunterEmailFinderResponse> = {
|
|
id: 'hunter_email_finder',
|
|
name: 'Hunter Email Finder',
|
|
description:
|
|
'Finds the most likely email address for a person given their name and company domain.',
|
|
version: '1.0.0',
|
|
|
|
hosting: {
|
|
envKeyPrefix: HUNTER_API_KEY_PREFIX,
|
|
apiKeyParam: 'apiKey',
|
|
byokProviderId: 'hunter',
|
|
pricing: {
|
|
type: 'custom',
|
|
getCost: (_params, output) => {
|
|
// Hunter counts one search credit only when an email is found.
|
|
const found = typeof output.email === 'string' && output.email.length > 0
|
|
const cost = found ? HUNTER_SEARCH_CREDIT_USD : 0
|
|
return { cost, metadata: { credits: found ? 1 : 0 } }
|
|
},
|
|
},
|
|
rateLimit: {
|
|
mode: 'per_request',
|
|
requestsPerMinute: 60,
|
|
},
|
|
},
|
|
|
|
params: {
|
|
domain: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Company domain name (e.g., "stripe.com", "company.io")',
|
|
},
|
|
first_name: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Person\'s first name (e.g., "John", "Sarah")',
|
|
},
|
|
last_name: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Person\'s last name (e.g., "Smith", "Johnson")',
|
|
},
|
|
company: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Company name (e.g., "Stripe", "Acme Inc")',
|
|
},
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Hunter.io API Key',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
const url = new URL('https://api.hunter.io/v2/email-finder')
|
|
url.searchParams.append('domain', params.domain)
|
|
url.searchParams.append('first_name', params.first_name)
|
|
url.searchParams.append('last_name', params.last_name)
|
|
url.searchParams.append('api_key', params.apiKey)
|
|
|
|
if (params.company) url.searchParams.append('company', params.company)
|
|
|
|
return url.toString()
|
|
},
|
|
method: 'GET',
|
|
headers: () => ({
|
|
'Content-Type': 'application/json',
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
const d = data.data ?? {}
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
first_name: d.first_name ?? '',
|
|
last_name: d.last_name ?? '',
|
|
email: d.email ?? '',
|
|
score: d.score ?? 0,
|
|
domain: d.domain ?? '',
|
|
accept_all: d.accept_all ?? false,
|
|
position: d.position ?? null,
|
|
twitter: d.twitter ?? null,
|
|
linkedin_url: d.linkedin_url ?? null,
|
|
phone_number: d.phone_number ?? null,
|
|
company: d.company ?? null,
|
|
sources: d.sources ?? [],
|
|
verification: d.verification ?? { date: null, status: 'unknown' },
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
first_name: { type: 'string', description: "Person's first name" },
|
|
last_name: { type: 'string', description: "Person's last name" },
|
|
email: { type: 'string', description: 'The found email address' },
|
|
score: {
|
|
type: 'number',
|
|
description: 'Confidence score (0-100) for the found email address',
|
|
},
|
|
domain: { type: 'string', description: 'Domain that was searched' },
|
|
accept_all: {
|
|
type: 'boolean',
|
|
description: 'Whether the server accepts all email addresses (may cause false positives)',
|
|
},
|
|
position: { type: 'string', description: 'Job title/position', optional: true },
|
|
twitter: { type: 'string', description: 'Twitter handle', optional: true },
|
|
linkedin_url: { type: 'string', description: 'LinkedIn profile URL', optional: true },
|
|
phone_number: { type: 'string', description: 'Phone number', optional: true },
|
|
company: { type: 'string', description: 'Company name', optional: true },
|
|
sources: SOURCES_OUTPUT,
|
|
verification: VERIFICATION_OUTPUT,
|
|
},
|
|
}
|