Skip to content

Commit f482689

Browse files
committed
fix(integrations): list wealthbox tasks and contacts without an id and keep email bison lead emails with slashes
1 parent 1d223b6 commit f482689

8 files changed

Lines changed: 38 additions & 14 deletions

File tree

‎apps/sim/blocks/blocks/wealthbox.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { describe, expect, it } from 'vitest'
22
import { WealthboxBlock } from '@/blocks/blocks/wealthbox'
3+
import { wealthboxReadContactTool } from '@/tools/wealthbox/read_contact'
34
import { wealthboxReadNoteTool } from '@/tools/wealthbox/read_note'
5+
import { wealthboxReadTaskTool } from '@/tools/wealthbox/read_task'
46
import { wealthboxWriteTaskTool } from '@/tools/wealthbox/write_task'
57

68
function mapParams(params: Record<string, unknown>, context?: { operation: string }) {
@@ -67,3 +69,19 @@ describe('Wealthbox Read Note without a note ID', () => {
6769
expect(result.output).toMatchObject({ notes, metadata: { totalItems: 1 } })
6870
})
6971
})
72+
73+
describe('Wealthbox canvas reads without an ID', () => {
74+
it('lists tasks when Read Task has no task ID', () => {
75+
const params = mapParams({ operation: 'read_task', oauthCredential: 'cred', taskId: '' })
76+
const url = wealthboxReadTaskTool.request.url as (p: Record<string, unknown>) => string
77+
78+
expect(url(params)).toBe('https://api.crmworkspace.com/v1/tasks')
79+
})
80+
81+
it('lists contacts when Read Contact has no contact ID', () => {
82+
const params = mapParams({ operation: 'read_contact', oauthCredential: 'cred', contactId: '' })
83+
const url = wealthboxReadContactTool.request.url as (p: Record<string, unknown>) => string
84+
85+
expect(url(params)).toBe('https://api.crmworkspace.com/v1/contacts')
86+
})
87+
})

‎apps/sim/blocks/blocks/wealthbox.ts‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const WealthboxBlock: BlockConfig = {
109109
id: 'taskId',
110110
title: 'Task ID',
111111
type: 'short-input',
112-
placeholder: 'Enter Task ID',
112+
placeholder: 'Enter Task ID (optional)',
113113
condition: { field: 'operation', value: ['read_task'] },
114114
},
115115
{
@@ -228,19 +228,13 @@ Return ONLY the date/time string - no explanations, no quotes, no extra text.`,
228228
}
229229
}
230230
if (operation === 'read_contact') {
231-
if (!effectiveContactId && !isToolCall(context)) {
232-
throw new Error('Contact ID is required for contact operations')
233-
}
234231
return {
235232
...baseParams,
236233
contactId: effectiveContactId,
237234
}
238235
}
239236
if (operation === 'read_task') {
240-
if (!taskId?.trim()) {
241-
if (isToolCall(context)) return baseParams
242-
throw new Error('Task ID is required for task operations')
243-
}
237+
if (!taskId?.trim()) return baseParams
244238
return {
245239
...baseParams,
246240
taskId: taskId.trim(),

‎apps/sim/tools/emailbison/get_lead.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const getLeadTool: ToolConfig<EmailBisonGetLeadParams, EmailBisonLeadResp
2929
request: {
3030
url: (params) =>
3131
emailBisonUrl(
32-
`/api/leads/${safeUrlPathSegment(params.leadId, 'leadId')}`,
32+
`/api/leads/${safeUrlPathSegment(params.leadId, 'leadId', { allowSeparators: true })}`,
3333
{},
3434
params.apiBaseUrl
3535
),

‎apps/sim/tools/emailbison/update_lead.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const updateLeadTool: ToolConfig<EmailBisonLeadMutationParams, EmailBison
8080
request: {
8181
url: (params) =>
8282
emailBisonUrl(
83-
`/api/leads/${safeUrlPathSegment(params.leadId ?? '', 'leadId')}`,
83+
`/api/leads/${safeUrlPathSegment(params.leadId ?? '', 'leadId', { allowSeparators: true })}`,
8484
{},
8585
params.apiBaseUrl
8686
),

‎apps/sim/tools/generated/tool-outputs.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎apps/sim/tools/wealthbox/read_contact.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ export const wealthboxReadContactTool: ToolConfig<WealthboxReadParams, Wealthbox
112112
description: 'Contact data and metadata',
113113
properties: {
114114
content: { type: 'string', description: 'Formatted contact information' },
115-
contact: { type: 'object', description: 'Raw contact data from Wealthbox' },
115+
contact: {
116+
type: 'object',
117+
description: 'Raw contact data from Wealthbox',
118+
optional: true,
119+
},
116120
contacts: {
117121
type: 'array',
118122
description: 'Contacts returned when no ID is given (list request)',

‎apps/sim/tools/wealthbox/read_note.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ export const wealthboxReadNoteTool: ToolConfig<WealthboxReadParams, WealthboxRea
116116
description: 'Note data and metadata',
117117
properties: {
118118
content: { type: 'string', description: 'Formatted note information' },
119-
note: { type: 'object', description: 'Raw note data from Wealthbox' },
119+
note: {
120+
type: 'object',
121+
description: 'Raw note data from Wealthbox',
122+
optional: true,
123+
},
120124
notes: {
121125
type: 'array',
122126
description: 'Notes returned when no ID is given (list request)',

‎apps/sim/tools/wealthbox/read_task.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ export const wealthboxReadTaskTool: ToolConfig<WealthboxReadParams, WealthboxRea
117117
description: 'Task data and metadata',
118118
properties: {
119119
content: { type: 'string', description: 'Formatted task information' },
120-
task: { type: 'object', description: 'Raw task data from Wealthbox' },
120+
task: {
121+
type: 'object',
122+
description: 'Raw task data from Wealthbox',
123+
optional: true,
124+
},
121125
tasks: {
122126
type: 'array',
123127
description: 'Tasks returned when no ID is given (list request)',

0 commit comments

Comments
 (0)