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
188 lines
5.2 KiB
TypeScript
188 lines
5.2 KiB
TypeScript
import type { InstantlyCreateLeadParams, InstantlyLeadResponse } from '@/tools/instantly/types'
|
|
import {
|
|
compactBody,
|
|
instantlyBaseParamFields,
|
|
instantlyHeaders,
|
|
instantlyUrl,
|
|
leadOutputs,
|
|
mapLead,
|
|
parseInstantlyResponse,
|
|
} from '@/tools/instantly/utils'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const createLeadTool: ToolConfig<InstantlyCreateLeadParams, InstantlyLeadResponse> = {
|
|
id: 'instantly_create_lead',
|
|
name: 'Instantly Create Lead',
|
|
description: 'Creates an Instantly V2 lead in a campaign or lead list.',
|
|
version: '1.0.0',
|
|
params: {
|
|
...instantlyBaseParamFields,
|
|
campaign: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Campaign ID associated with the lead',
|
|
},
|
|
list_id: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Lead list ID associated with the lead',
|
|
},
|
|
email: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Lead email address. Required when adding to a campaign.',
|
|
},
|
|
first_name: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Lead first name',
|
|
},
|
|
last_name: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Lead last name',
|
|
},
|
|
company_name: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Lead company name',
|
|
},
|
|
job_title: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Lead job title',
|
|
},
|
|
phone: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Lead phone number',
|
|
},
|
|
website: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Lead website',
|
|
},
|
|
personalization: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Lead personalization text',
|
|
},
|
|
lt_interest_status: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Lead interest status value',
|
|
},
|
|
pl_value_lead: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Potential value of the lead',
|
|
},
|
|
assigned_to: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Organization user ID assigned to the lead',
|
|
},
|
|
skip_if_in_workspace: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Skip if the lead already exists in the workspace',
|
|
},
|
|
skip_if_in_campaign: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Skip if the lead already exists in the campaign',
|
|
},
|
|
skip_if_in_list: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Skip if the lead already exists in the list',
|
|
},
|
|
blocklist_id: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Blocklist ID to check for the lead',
|
|
},
|
|
verify_leads_for_lead_finder: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Whether to verify leads imported from Lead Finder',
|
|
},
|
|
verify_leads_on_import: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Whether to verify leads on import',
|
|
},
|
|
custom_variables: {
|
|
type: 'json',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Custom variable object with string, number, boolean, or null values',
|
|
},
|
|
},
|
|
request: {
|
|
url: () => instantlyUrl('/api/v2/leads'),
|
|
method: 'POST',
|
|
headers: instantlyHeaders,
|
|
body: (params) =>
|
|
compactBody({
|
|
campaign: params.campaign,
|
|
list_id: params.list_id,
|
|
email: params.email,
|
|
first_name: params.first_name,
|
|
last_name: params.last_name,
|
|
company_name: params.company_name,
|
|
job_title: params.job_title,
|
|
phone: params.phone,
|
|
website: params.website,
|
|
personalization: params.personalization,
|
|
lt_interest_status: params.lt_interest_status,
|
|
pl_value_lead: params.pl_value_lead,
|
|
assigned_to: params.assigned_to,
|
|
skip_if_in_workspace: params.skip_if_in_workspace,
|
|
skip_if_in_campaign: params.skip_if_in_campaign,
|
|
skip_if_in_list: params.skip_if_in_list,
|
|
blocklist_id: params.blocklist_id,
|
|
verify_leads_for_lead_finder: params.verify_leads_for_lead_finder,
|
|
verify_leads_on_import: params.verify_leads_on_import,
|
|
custom_variables: params.custom_variables,
|
|
}),
|
|
},
|
|
transformResponse: async (response) => {
|
|
const data = await parseInstantlyResponse(response)
|
|
const lead = mapLead(data)
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
lead,
|
|
id: lead.id,
|
|
email_address: lead.email,
|
|
first_name: lead.first_name,
|
|
last_name: lead.last_name,
|
|
campaign: lead.campaign,
|
|
status: lead.status,
|
|
},
|
|
}
|
|
},
|
|
outputs: leadOutputs,
|
|
}
|