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
143 lines
3.7 KiB
TypeScript
143 lines
3.7 KiB
TypeScript
import type {
|
|
InstantlyCampaignResponse,
|
|
InstantlyPatchCampaignParams,
|
|
} from '@/tools/instantly/types'
|
|
import {
|
|
campaignOutputs,
|
|
compactBody,
|
|
instantlyBaseParamFields,
|
|
instantlyHeaders,
|
|
instantlyUrl,
|
|
mapCampaign,
|
|
parseInstantlyResponse,
|
|
} from '@/tools/instantly/utils'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const patchCampaignTool: ToolConfig<
|
|
InstantlyPatchCampaignParams,
|
|
InstantlyCampaignResponse
|
|
> = {
|
|
id: 'instantly_patch_campaign',
|
|
name: 'Instantly Patch Campaign',
|
|
description: 'Updates documented Instantly V2 campaign fields.',
|
|
version: '1.0.0',
|
|
params: {
|
|
...instantlyBaseParamFields,
|
|
campaignId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description: 'Campaign ID',
|
|
},
|
|
name: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Campaign name',
|
|
},
|
|
campaign_schedule: {
|
|
type: 'json',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Campaign schedule object with schedules array',
|
|
},
|
|
sequences: {
|
|
type: 'array',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Campaign sequence definitions',
|
|
items: { type: 'object', description: 'Sequence object' },
|
|
},
|
|
email_list: {
|
|
type: 'array',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Sending email accounts',
|
|
items: { type: 'string', description: 'Email address' },
|
|
},
|
|
daily_limit: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Daily sending limit',
|
|
},
|
|
daily_max_leads: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Daily maximum new leads to contact',
|
|
},
|
|
open_tracking: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Whether to track opens',
|
|
},
|
|
stop_on_reply: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Whether to stop the campaign on reply',
|
|
},
|
|
link_tracking: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Whether to track links',
|
|
},
|
|
text_only: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Whether the campaign is text only',
|
|
},
|
|
email_gap: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Gap between emails in minutes',
|
|
},
|
|
pl_value: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Value of every positive lead',
|
|
},
|
|
},
|
|
request: {
|
|
url: (params) => instantlyUrl(`/api/v2/campaigns/${params.campaignId.trim()}`),
|
|
method: 'PATCH',
|
|
headers: instantlyHeaders,
|
|
body: (params) =>
|
|
compactBody({
|
|
name: params.name,
|
|
campaign_schedule: params.campaign_schedule,
|
|
sequences: params.sequences,
|
|
pl_value: params.pl_value,
|
|
email_gap: params.email_gap,
|
|
text_only: params.text_only,
|
|
email_list: params.email_list,
|
|
daily_limit: params.daily_limit,
|
|
stop_on_reply: params.stop_on_reply,
|
|
link_tracking: params.link_tracking,
|
|
open_tracking: params.open_tracking,
|
|
daily_max_leads: params.daily_max_leads,
|
|
}),
|
|
},
|
|
transformResponse: async (response) => {
|
|
const data = await parseInstantlyResponse(response)
|
|
const campaign = mapCampaign(data)
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
campaign,
|
|
id: campaign.id,
|
|
name: campaign.name,
|
|
status: campaign.status,
|
|
},
|
|
}
|
|
},
|
|
outputs: campaignOutputs,
|
|
}
|