d25d482dc2
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
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
152 lines
4.4 KiB
TypeScript
152 lines
4.4 KiB
TypeScript
import type { ApolloPeopleEnrichParams, ApolloPeopleEnrichResponse } from '@/tools/apollo/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const apolloPeopleEnrichTool: ToolConfig<
|
|
ApolloPeopleEnrichParams,
|
|
ApolloPeopleEnrichResponse
|
|
> = {
|
|
id: 'apollo_people_enrich',
|
|
name: 'Apollo People Enrichment',
|
|
description: 'Enrich data for a single person using Apollo',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Apollo API key',
|
|
},
|
|
first_name: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'First name of the person',
|
|
},
|
|
last_name: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Last name of the person',
|
|
},
|
|
name: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Full name of the person (alternative to first_name/last_name)',
|
|
},
|
|
id: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Apollo ID for the person',
|
|
},
|
|
hashed_email: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'MD5 or SHA-256 hashed email',
|
|
},
|
|
email: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Email address of the person',
|
|
},
|
|
organization_name: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Company name where the person works',
|
|
},
|
|
domain: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Company domain (e.g., "apollo.io", "acme.com")',
|
|
},
|
|
linkedin_url: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'LinkedIn profile URL',
|
|
},
|
|
reveal_personal_emails: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Reveal personal email addresses (uses credits)',
|
|
},
|
|
reveal_phone_number: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description: 'Reveal phone numbers (uses credits, requires webhook_url)',
|
|
},
|
|
webhook_url: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-only',
|
|
description:
|
|
'Webhook URL for async phone number delivery (required when reveal_phone_number is true)',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params: ApolloPeopleEnrichParams) => {
|
|
const qs = new URLSearchParams()
|
|
if (params.first_name) qs.set('first_name', params.first_name)
|
|
if (params.last_name) qs.set('last_name', params.last_name)
|
|
if (params.name) qs.set('name', params.name)
|
|
if (params.email) qs.set('email', params.email)
|
|
if (params.hashed_email) qs.set('hashed_email', params.hashed_email)
|
|
if (params.id) qs.set('id', params.id)
|
|
if (params.organization_name) qs.set('organization_name', params.organization_name)
|
|
if (params.domain) qs.set('domain', params.domain)
|
|
if (params.linkedin_url) qs.set('linkedin_url', params.linkedin_url)
|
|
if (params.reveal_personal_emails !== undefined) {
|
|
qs.set('reveal_personal_emails', String(params.reveal_personal_emails))
|
|
}
|
|
if (params.reveal_phone_number !== undefined) {
|
|
qs.set('reveal_phone_number', String(params.reveal_phone_number))
|
|
}
|
|
if (params.webhook_url) {
|
|
qs.set('webhook_url', params.webhook_url)
|
|
}
|
|
const query = qs.toString()
|
|
return `https://api.apollo.io/api/v1/people/match${query ? `?${query}` : ''}`
|
|
},
|
|
method: 'POST',
|
|
headers: (params: ApolloPeopleEnrichParams) => ({
|
|
'Cache-Control': 'no-cache',
|
|
'X-Api-Key': params.apiKey,
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
if (!response.ok) {
|
|
const errorText = await response.text()
|
|
throw new Error(`Apollo API error: ${response.status} - ${errorText}`)
|
|
}
|
|
|
|
const data = await response.json()
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
person: data.person ?? null,
|
|
enriched: !!data.person,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
person: {
|
|
type: 'json',
|
|
description: 'Enriched person data from Apollo',
|
|
optional: true,
|
|
},
|
|
enriched: { type: 'boolean', description: 'Whether the person was successfully enriched' },
|
|
},
|
|
}
|