mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
fix tools
This commit is contained in:
@@ -78,13 +78,17 @@ export const LemlistBlock: BlockConfig<LemlistResponse> = {
|
||||
type: 'short-input',
|
||||
placeholder: 'Enter lead email address',
|
||||
condition: { field: 'operation', value: 'get_lead' },
|
||||
mode: 'basic',
|
||||
canonicalParamId: 'leadIdentifier',
|
||||
},
|
||||
{
|
||||
id: 'id',
|
||||
id: 'leadIdLookup',
|
||||
title: 'Lead ID',
|
||||
type: 'short-input',
|
||||
placeholder: 'Or enter lead ID',
|
||||
placeholder: 'Enter lead ID',
|
||||
condition: { field: 'operation', value: 'get_lead' },
|
||||
mode: 'advanced',
|
||||
canonicalParamId: 'leadIdentifier',
|
||||
},
|
||||
{
|
||||
id: 'sendUserId',
|
||||
@@ -193,8 +197,7 @@ export const LemlistBlock: BlockConfig<LemlistResponse> = {
|
||||
leadId: { type: 'string', description: 'Lead ID' },
|
||||
limit: { type: 'number', description: 'Result limit' },
|
||||
offset: { type: 'number', description: 'Result offset' },
|
||||
email: { type: 'string', description: 'Lead email address' },
|
||||
id: { type: 'string', description: 'Lead ID for lookup' },
|
||||
leadIdentifier: { type: 'string', description: 'Lead email address or ID' },
|
||||
sendUserId: { type: 'string', description: 'Sender user ID' },
|
||||
sendUserEmail: { type: 'string', description: 'Sender email address' },
|
||||
sendUserMailboxId: { type: 'string', description: 'Sender mailbox ID' },
|
||||
|
||||
@@ -14,29 +14,22 @@ export const getLeadTool: ToolConfig<LemlistGetLeadParams, LemlistGetLeadRespons
|
||||
visibility: 'user-only',
|
||||
description: 'Lemlist API key',
|
||||
},
|
||||
email: {
|
||||
leadIdentifier: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Lead email address (use either email or id)',
|
||||
},
|
||||
id: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'Lead ID (use either email or id)',
|
||||
description: 'Lead email address or lead ID',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const url = new URL('https://api.lemlist.com/api/leads')
|
||||
url.searchParams.append('version', 'v2')
|
||||
|
||||
if (params.email) url.searchParams.append('email', params.email)
|
||||
if (params.id) url.searchParams.append('id', params.id)
|
||||
|
||||
return url.toString()
|
||||
const identifier = params.leadIdentifier || ''
|
||||
const isEmail = identifier.includes('@')
|
||||
if (isEmail) {
|
||||
return `https://api.lemlist.com/api/leads/${encodeURIComponent(identifier)}`
|
||||
}
|
||||
return `https://api.lemlist.com/api/leads?id=${encodeURIComponent(identifier)}`
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params) => {
|
||||
|
||||
@@ -75,12 +75,12 @@ export const sendEmailTool: ToolConfig<LemlistSendEmailParams, LemlistSendEmailR
|
||||
}
|
||||
},
|
||||
body: (params) => ({
|
||||
sendUserId: params.sendUserId,
|
||||
sendUserEmail: params.sendUserEmail,
|
||||
sendUserMailboxId: params.sendUserMailboxId,
|
||||
contactId: params.contactId,
|
||||
leadId: params.leadId,
|
||||
subject: params.subject,
|
||||
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 ?? [],
|
||||
}),
|
||||
|
||||
@@ -31,8 +31,7 @@ export interface LemlistGetActivitiesResponse extends ToolResponse {
|
||||
}
|
||||
|
||||
export interface LemlistGetLeadParams extends LemlistBaseParams {
|
||||
email?: string
|
||||
id?: string
|
||||
leadIdentifier: string
|
||||
}
|
||||
|
||||
export interface LemlistLead {
|
||||
|
||||
Reference in New Issue
Block a user