Skip to content

Commit 709dfcc

Browse files
committed
fix tools
1 parent 454e53e commit 709dfcc

File tree

4 files changed

+23
-28
lines changed

4 files changed

+23
-28
lines changed

apps/sim/blocks/blocks/lemlist.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,17 @@ export const LemlistBlock: BlockConfig<LemlistResponse> = {
7878
type: 'short-input',
7979
placeholder: 'Enter lead email address',
8080
condition: { field: 'operation', value: 'get_lead' },
81+
mode: 'basic',
82+
canonicalParamId: 'leadIdentifier',
8183
},
8284
{
83-
id: 'id',
85+
id: 'leadIdLookup',
8486
title: 'Lead ID',
8587
type: 'short-input',
86-
placeholder: 'Or enter lead ID',
88+
placeholder: 'Enter lead ID',
8789
condition: { field: 'operation', value: 'get_lead' },
90+
mode: 'advanced',
91+
canonicalParamId: 'leadIdentifier',
8892
},
8993
{
9094
id: 'sendUserId',
@@ -193,8 +197,7 @@ export const LemlistBlock: BlockConfig<LemlistResponse> = {
193197
leadId: { type: 'string', description: 'Lead ID' },
194198
limit: { type: 'number', description: 'Result limit' },
195199
offset: { type: 'number', description: 'Result offset' },
196-
email: { type: 'string', description: 'Lead email address' },
197-
id: { type: 'string', description: 'Lead ID for lookup' },
200+
leadIdentifier: { type: 'string', description: 'Lead email address or ID' },
198201
sendUserId: { type: 'string', description: 'Sender user ID' },
199202
sendUserEmail: { type: 'string', description: 'Sender email address' },
200203
sendUserMailboxId: { type: 'string', description: 'Sender mailbox ID' },

apps/sim/tools/lemlist/get_lead.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,22 @@ export const getLeadTool: ToolConfig<LemlistGetLeadParams, LemlistGetLeadRespons
1414
visibility: 'user-only',
1515
description: 'Lemlist API key',
1616
},
17-
email: {
18-
type: 'string',
19-
required: false,
20-
visibility: 'user-or-llm',
21-
description: 'Lead email address (use either email or id)',
22-
},
23-
id: {
17+
leadIdentifier: {
2418
type: 'string',
25-
required: false,
19+
required: true,
2620
visibility: 'user-or-llm',
27-
description: 'Lead ID (use either email or id)',
21+
description: 'Lead email address or lead ID',
2822
},
2923
},
3024

3125
request: {
3226
url: (params) => {
33-
const url = new URL('https://api.lemlist.com/api/leads')
34-
url.searchParams.append('version', 'v2')
35-
36-
if (params.email) url.searchParams.append('email', params.email)
37-
if (params.id) url.searchParams.append('id', params.id)
38-
39-
return url.toString()
27+
const identifier = params.leadIdentifier || ''
28+
const isEmail = identifier.includes('@')
29+
if (isEmail) {
30+
return `https://api.lemlist.com/api/leads/${encodeURIComponent(identifier)}`
31+
}
32+
return `https://api.lemlist.com/api/leads?id=${encodeURIComponent(identifier)}`
4033
},
4134
method: 'GET',
4235
headers: (params) => {

apps/sim/tools/lemlist/send_email.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ export const sendEmailTool: ToolConfig<LemlistSendEmailParams, LemlistSendEmailR
7575
}
7676
},
7777
body: (params) => ({
78-
sendUserId: params.sendUserId,
79-
sendUserEmail: params.sendUserEmail,
80-
sendUserMailboxId: params.sendUserMailboxId,
81-
contactId: params.contactId,
82-
leadId: params.leadId,
83-
subject: params.subject,
78+
sendUserId: params.sendUserId?.trim(),
79+
sendUserEmail: params.sendUserEmail?.trim(),
80+
sendUserMailboxId: params.sendUserMailboxId?.trim(),
81+
contactId: params.contactId?.trim(),
82+
leadId: params.leadId?.trim(),
83+
subject: params.subject?.trim(),
8484
message: params.message,
8585
cc: params.cc ?? [],
8686
}),

apps/sim/tools/lemlist/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ export interface LemlistGetActivitiesResponse extends ToolResponse {
3131
}
3232

3333
export interface LemlistGetLeadParams extends LemlistBaseParams {
34-
email?: string
35-
id?: string
34+
leadIdentifier: string
3635
}
3736

3837
export interface LemlistLead {

0 commit comments

Comments
 (0)