Skip to content

Commit 91a65ff

Browse files
committed
fix(integrations): never forward a task id on wealthbox write task and validate raw read ids
1 parent dfaa756 commit 91a65ff

6 files changed

Lines changed: 24 additions & 9 deletions

File tree

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ describe('Wealthbox reads without an ID', () => {
121121
})
122122

123123
describe('Wealthbox Write Task with a stale Read Task ID', () => {
124+
it('drops a stored task ID on an agent call too', () => {
125+
const params = mapParams(
126+
{ oauthCredential: 'cred', title: 'Call client', dueDate: 'tomorrow', taskId: '999' },
127+
{ operation: 'write_task' }
128+
)
129+
130+
expect(params.taskId).toBeUndefined()
131+
})
132+
124133
it('creates the task instead of posting to the stale task path', () => {
125134
const params = mapParams({
126135
operation: 'write_task',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ Return ONLY the date/time string - no explanations, no quotes, no extra text.`,
252252
const taskParams = {
253253
...baseParams,
254254
...(description ? { description } : {}),
255-
taskId: toolCallArg(context, taskId),
255+
taskId: undefined,
256256
}
257257
if (!contactId?.trim()) {
258258
if (isToolCall(context)) return taskParams

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ export const wealthboxReadContactTool: ToolConfig<WealthboxReadParams, Wealthbox
3030

3131
request: {
3232
url: (params) => {
33-
const contactId = params.contactId == null ? '' : String(params.contactId).trim()
34-
if (!contactId) return 'https://api.crmworkspace.com/v1/contacts'
33+
const contactId = params.contactId
34+
if (contactId == null || (typeof contactId === 'string' && !contactId.trim())) {
35+
return 'https://api.crmworkspace.com/v1/contacts'
36+
}
3537
return `https://api.crmworkspace.com/v1/contacts/${safeUrlPathSegment(contactId, 'contactId')}`
3638
},
3739
method: 'GET',

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ export const wealthboxReadNoteTool: ToolConfig<WealthboxReadParams, WealthboxRea
3030

3131
request: {
3232
url: (params) => {
33-
const noteId = params.noteId == null ? '' : String(params.noteId).trim()
34-
if (!noteId) return 'https://api.crmworkspace.com/v1/notes'
33+
const noteId = params.noteId
34+
if (noteId == null || (typeof noteId === 'string' && !noteId.trim())) {
35+
return 'https://api.crmworkspace.com/v1/notes'
36+
}
3537
return `https://api.crmworkspace.com/v1/notes/${safeUrlPathSegment(noteId, 'noteId')}`
3638
},
3739
method: 'GET',

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ export const wealthboxReadTaskTool: ToolConfig<WealthboxReadParams, WealthboxRea
3030

3131
request: {
3232
url: (params) => {
33-
const taskId = params.taskId == null ? '' : String(params.taskId).trim()
34-
if (!taskId) return 'https://api.crmworkspace.com/v1/tasks'
33+
const taskId = params.taskId
34+
if (taskId == null || (typeof taskId === 'string' && !taskId.trim())) {
35+
return 'https://api.crmworkspace.com/v1/tasks'
36+
}
3537
return `https://api.crmworkspace.com/v1/tasks/${safeUrlPathSegment(taskId, 'taskId')}`
3638
},
3739
method: 'GET',

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export const wealthboxWriteTaskTool: ToolConfig<WealthboxWriteParams, WealthboxW
5050

5151
request: {
5252
url: (params) => {
53-
const taskId = params.taskId == null ? '' : String(params.taskId).trim()
54-
if (taskId) {
53+
const taskId = params.taskId
54+
if (taskId != null && !(typeof taskId === 'string' && !taskId.trim())) {
5555
return `https://api.crmworkspace.com/v1/tasks/${safeUrlPathSegment(taskId, 'taskId')}`
5656
}
5757
return 'https://api.crmworkspace.com/v1/tasks'

0 commit comments

Comments
 (0)