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
132 lines
4.1 KiB
TypeScript
132 lines
4.1 KiB
TypeScript
import type {
|
|
LemlistGetActivitiesParams,
|
|
LemlistGetActivitiesResponse,
|
|
} from '@/tools/lemlist/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const getActivitiesTool: ToolConfig<
|
|
LemlistGetActivitiesParams,
|
|
LemlistGetActivitiesResponse
|
|
> = {
|
|
id: 'lemlist_get_activities',
|
|
name: 'Lemlist Get Activities',
|
|
description:
|
|
'Retrieves campaign activities and steps performed, including email opens, clicks, replies, and other events.',
|
|
version: '1.0.0',
|
|
|
|
params: {
|
|
apiKey: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-only',
|
|
description: 'Lemlist API key',
|
|
},
|
|
type: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'Filter by activity type (e.g., emailOpened, emailClicked, emailReplied, paused)',
|
|
},
|
|
campaignId: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Filter by campaign ID (e.g., "cam_abc123def456")',
|
|
},
|
|
leadId: {
|
|
type: 'string',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Filter by lead ID (e.g., "lea_abc123def456")',
|
|
},
|
|
isFirst: {
|
|
type: 'boolean',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Filter for first activity only',
|
|
},
|
|
limit: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Number of results per request (e.g., 50). Max 100, default 100',
|
|
},
|
|
offset: {
|
|
type: 'number',
|
|
required: false,
|
|
visibility: 'user-or-llm',
|
|
description: 'Number of records to skip for pagination (e.g., 0, 100, 200)',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
const url = new URL('https://api.lemlist.com/api/activities')
|
|
url.searchParams.append('version', 'v2')
|
|
|
|
if (params.type) url.searchParams.append('type', params.type)
|
|
if (params.campaignId) url.searchParams.append('campaignId', params.campaignId)
|
|
if (params.leadId) url.searchParams.append('leadId', params.leadId)
|
|
if (params.isFirst !== undefined) url.searchParams.append('isFirst', String(params.isFirst))
|
|
if (params.limit !== undefined) url.searchParams.append('limit', String(params.limit))
|
|
if (params.offset !== undefined) url.searchParams.append('offset', String(params.offset))
|
|
|
|
return url.toString()
|
|
},
|
|
method: 'GET',
|
|
headers: (params) => {
|
|
const credentials = Buffer.from(`:${params.apiKey}`).toString('base64')
|
|
return {
|
|
Authorization: `Basic ${credentials}`,
|
|
'Content-Type': 'application/json',
|
|
}
|
|
},
|
|
},
|
|
|
|
transformResponse: async (response: Response) => {
|
|
const data = await response.json()
|
|
|
|
const activities = Array.isArray(data) ? data : []
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
activities: activities.map((activity: Record<string, unknown>) => ({
|
|
_id: (activity._id as string) ?? '',
|
|
type: (activity.type as string) ?? '',
|
|
leadId: (activity.leadId as string) ?? '',
|
|
campaignId: (activity.campaignId as string) ?? '',
|
|
sequenceId: (activity.sequenceId as string) ?? null,
|
|
stepId: (activity.stepId as string) ?? null,
|
|
createdAt: (activity.createdAt as string) ?? '',
|
|
})),
|
|
count: activities.length,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
activities: {
|
|
type: 'array',
|
|
description: 'List of activities',
|
|
items: {
|
|
type: 'object',
|
|
properties: {
|
|
_id: { type: 'string', description: 'Activity ID' },
|
|
type: { type: 'string', description: 'Activity type' },
|
|
leadId: { type: 'string', description: 'Associated lead ID' },
|
|
campaignId: { type: 'string', description: 'Campaign ID' },
|
|
sequenceId: { type: 'string', description: 'Sequence ID', optional: true },
|
|
stepId: { type: 'string', description: 'Step ID', optional: true },
|
|
createdAt: { type: 'string', description: 'When the activity occurred' },
|
|
},
|
|
},
|
|
},
|
|
count: {
|
|
type: 'number',
|
|
description: 'Number of activities returned',
|
|
},
|
|
},
|
|
}
|