Files
simstudioai--sim/apps/sim/tools/lemlist/send_email.ts
T
wehub-resource-sync 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
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

107 lines
2.8 KiB
TypeScript

import type { LemlistSendEmailParams, LemlistSendEmailResponse } from '@/tools/lemlist/types'
import type { ToolConfig } from '@/tools/types'
export const sendEmailTool: ToolConfig<LemlistSendEmailParams, LemlistSendEmailResponse> = {
id: 'lemlist_send_email',
name: 'Lemlist Send Email',
description: 'Sends an email to a contact through the Lemlist inbox.',
version: '1.0.0',
params: {
apiKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Lemlist API key',
},
sendUserId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Identifier for the user sending the message (e.g., "usr_abc123def456")',
},
sendUserEmail: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Email address of the sender (e.g., "sales@company.com")',
},
sendUserMailboxId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Mailbox identifier for the sender (e.g., "mbx_abc123def456")',
},
contactId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Recipient contact identifier (e.g., "con_abc123def456")',
},
leadId: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Associated lead identifier (e.g., "lea_abc123def456")',
},
subject: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Email subject line',
},
message: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Email message body in HTML format',
},
cc: {
type: 'json',
required: false,
visibility: 'user-or-llm',
description: 'Array of CC email addresses',
},
},
request: {
url: () => 'https://api.lemlist.com/api/inbox/email',
method: 'POST',
headers: (params) => {
const credentials = Buffer.from(`:${params.apiKey}`).toString('base64')
return {
Authorization: `Basic ${credentials}`,
'Content-Type': 'application/json',
}
},
body: (params) => ({
sendUserId: params.sendUserId?.trim(),
sendUserEmail: params.sendUserEmail?.trim(),
sendUserMailboxId: params.sendUserMailboxId?.trim(),
contactId: params.contactId?.trim(),
leadId: params.leadId?.trim(),
subject: params.subject?.trim(),
message: params.message,
cc: params.cc ?? [],
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
return {
success: true,
output: {
ok: data.ok ?? true,
},
}
},
outputs: {
ok: {
type: 'boolean',
description: 'Whether the email was sent successfully',
},
},
}