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

87 lines
2.3 KiB
TypeScript

import type { InstantlyEmailResponse, InstantlyReplyToEmailParams } from '@/tools/instantly/types'
import {
compactBody,
emailOutputs,
instantlyBaseParamFields,
instantlyHeaders,
instantlyUrl,
mapEmail,
parseInstantlyResponse,
} from '@/tools/instantly/utils'
import type { ToolConfig } from '@/tools/types'
export const replyToEmailTool: ToolConfig<InstantlyReplyToEmailParams, InstantlyEmailResponse> = {
id: 'instantly_reply_to_email',
name: 'Instantly Reply To Email',
description: 'Sends an Instantly V2 reply to an existing Unibox email.',
version: '1.0.0',
params: {
...instantlyBaseParamFields,
eaccount: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Connected email account used to send the reply',
},
reply_to_uuid: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Email ID to reply to',
},
subject: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Reply subject',
},
body: {
type: 'json',
required: true,
visibility: 'user-or-llm',
description: 'Reply body object with text and/or html',
},
cc_address_email_list: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated CC email addresses',
},
bcc_address_email_list: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated BCC email addresses',
},
},
request: {
url: () => instantlyUrl('/api/v2/emails/reply'),
method: 'POST',
headers: instantlyHeaders,
body: (params) =>
compactBody({
eaccount: params.eaccount,
reply_to_uuid: params.reply_to_uuid,
subject: params.subject,
body: params.body,
cc_address_email_list: params.cc_address_email_list,
bcc_address_email_list: params.bcc_address_email_list,
}),
},
transformResponse: async (response) => {
const data = await parseInstantlyResponse(response)
const email = mapEmail(data)
return {
success: true,
output: {
email,
id: email.id,
subject: email.subject,
thread_id: email.thread_id,
},
}
},
outputs: emailOutputs,
}