Skip to content

Commit 2349259

Browse files
committed
fix(integrations): align Mailchimp, Attio, HubSpot, Zendesk, Supabase, and ServiceNow requests and outputs with their API specs
1 parent ed1af53 commit 2349259

34 files changed

Lines changed: 206 additions & 43 deletions

‎apps/docs/content/docs/integrations/mailchimp.mdx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ Update an existing audience (list) in Mailchimp
115115
| `audienceName` | string | No | The name of the audience/list \(e.g., "Newsletter Subscribers"\) |
116116
| `permissionReminder` | string | No | Permission reminder text shown to subscribers \(e.g., "You signed up for updates on our website"\) |
117117
| `campaignDefaults` | string | No | JSON object of default campaign settings \(e.g., \{"from_name": "Acme", "from_email": "news@acme.com"\}\) |
118-
| `emailTypeOption` | string | No | Support multiple email formats: "true" or "false" |
118+
| `emailTypeOption` | string | No | Support multiple email formats: "true" or "false". Omit to leave it unchanged |
119+
| `contact` | string | No | JSON object of contact information \(e.g., \{"company": "Acme", "address1": "123 Main St", "city": "NYC", "state": "NY", "zip": "10001", "country": "US"\}\) |
119120

120121
#### Output
121122

@@ -1627,7 +1628,7 @@ Create a new landing page in Mailchimp
16271628

16281629
| Parameter | Type | Required | Description |
16291630
| --------- | ---- | -------- | ----------- |
1630-
| `landingPageType` | string | Yes | The type of landing page: "signup" |
1631+
| `landingPageType` | string | Yes | The type of landing page: "signup" or "product" |
16311632
| `landingPageTitle` | string | No | The title of the landing page \(e.g., "Join Our Newsletter"\) |
16321633

16331634
#### Output

‎apps/docs/content/docs/integrations/supabase.mdx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,8 @@ Move a file within a Supabase storage bucket
473473
| `message` | string | Operation status message |
474474
| `results` | object | Move operation result |
475475
| ↳ `message` | string | Operation status message |
476-
| ↳ `Id` | string | Identifier of the destination object |
477-
| ↳ `Key` | string | Full object key of the destination |
476+
| ↳ `Id` | string | Not returned by the move endpoint, which responds with only a message |
477+
| ↳ `Key` | string | Not returned by the move endpoint, which responds with only a message |
478478

479479
</ReferenceDetails>
480480

‎apps/sim/blocks/blocks/mailchimp.ts‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,10 +647,24 @@ Return ONLY the JSON object - no explanations or markdown.`,
647647
},
648648
condition: {
649649
field: 'operation',
650-
value: ['create_audience', 'update_audience'],
650+
value: ['create_audience'],
651651
},
652652
value: () => 'true',
653653
},
654+
{
655+
id: 'updateEmailTypeOption',
656+
title: 'Email Type Option',
657+
type: 'dropdown',
658+
options: [
659+
{ label: 'No change', id: '' },
660+
{ label: 'True', id: 'true' },
661+
{ label: 'False', id: 'false' },
662+
],
663+
condition: {
664+
field: 'operation',
665+
value: ['update_audience'],
666+
},
667+
},
654668
// Member fields
655669
{
656670
id: 'subscriberEmail',
@@ -1545,7 +1559,8 @@ Return ONLY the landing page title - no explanations.`,
15451559
type: 'dropdown',
15461560
options: [
15471561
{ label: 'Signup', id: 'signup' },
1548-
{ label: 'Click Through', id: 'click-through' },
1562+
{ label: 'Product', id: 'product' },
1563+
{ label: 'Click Through (legacy)', id: 'click-through' },
15491564
],
15501565
required: {
15511566
field: 'operation',
@@ -1738,8 +1753,10 @@ Return ONLY the JSON array - no explanations or markdown.`,
17381753
return `mailchimp_${params.operation}`
17391754
},
17401755
params: (params) => {
1741-
const { apiKey, operation, ...rest } = params
1756+
const { apiKey, operation, updateEmailTypeOption, ...rest } = params
17421757
const cleanParams: Record<string, any> = { apiKey }
1758+
/** Update Audience has its own dropdown whose blank default leaves the setting unchanged. */
1759+
if (updateEmailTypeOption) cleanParams.emailTypeOption = updateEmailTypeOption
17431760

17441761
Object.entries(rest).forEach(([key, value]) => {
17451762
if (value !== undefined && value !== null && value !== '') {
@@ -1753,6 +1770,10 @@ Return ONLY the JSON array - no explanations or markdown.`,
17531770
inputs: {
17541771
operation: { type: 'string', description: 'Operation to perform' },
17551772
apiKey: { type: 'string', description: 'Mailchimp API key with server prefix' },
1773+
updateEmailTypeOption: {
1774+
type: 'string',
1775+
description: 'Email type option for Update Audience; blank leaves it unchanged',
1776+
},
17561777
},
17571778
outputs: {
17581779
success: { type: 'boolean', description: 'Operation success status' },

‎apps/sim/tools/attio/create_task.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ export const attioCreateTaskTool: ToolConfig<AttioCreateTaskParams, AttioCreateT
7575
: params.linkedRecords
7676
}
7777
} catch {
78-
linkedRecords = []
78+
throw new Error('Invalid JSON provided for linked records')
7979
}
8080
try {
8181
if (params.assignees) {
8282
assignees =
8383
typeof params.assignees === 'string' ? JSON.parse(params.assignees) : params.assignees
8484
}
8585
} catch {
86-
assignees = []
86+
throw new Error('Invalid JSON provided for assignees')
8787
}
8888
return {
8989
data: {

‎apps/sim/tools/attio/create_webhook.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const attioCreateWebhookTool: ToolConfig<
5656
? JSON.parse(params.subscriptions)
5757
: params.subscriptions
5858
} catch {
59-
subscriptions = []
59+
throw new Error('Invalid JSON provided for subscriptions')
6060
}
6161
return {
6262
data: {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { describe, expect, it } from 'vitest'
2+
import { attioCreateWebhookTool } from '@/tools/attio/create_webhook'
3+
import { attioQueryListEntriesTool } from '@/tools/attio/query_list_entries'
4+
import { attioUpdateTaskTool } from '@/tools/attio/update_task'
5+
6+
function bodyOf<P>(tool: { request: { body?: (params: P) => unknown } }, params: P): unknown {
7+
return tool.request.body?.(params)
8+
}
9+
10+
describe('Attio JSON inputs', () => {
11+
it('rejects malformed assignees instead of clearing every assignee on the task', () => {
12+
expect(() =>
13+
bodyOf(attioUpdateTaskTool, { accessToken: 't', taskId: 'task-1', assignees: '[{bad' })
14+
).toThrow('Invalid JSON provided for assignees')
15+
})
16+
17+
it('rejects a malformed filter instead of returning every list entry', () => {
18+
expect(() =>
19+
bodyOf(attioQueryListEntriesTool, { accessToken: 't', list: 'list-1', filter: '{bad' })
20+
).toThrow('Invalid JSON provided for filter')
21+
})
22+
23+
it('rejects malformed subscriptions instead of creating a webhook with none', () => {
24+
expect(() =>
25+
bodyOf(attioCreateWebhookTool, {
26+
accessToken: 't',
27+
targetUrl: 'https://example.com/hook',
28+
subscriptions: '[{bad',
29+
})
30+
).toThrow('Invalid JSON provided for subscriptions')
31+
})
32+
})

‎apps/sim/tools/attio/query_list_entries.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,14 @@ export const attioQueryListEntriesTool: ToolConfig<
7373
body.filter =
7474
typeof params.filter === 'string' ? JSON.parse(params.filter) : params.filter
7575
} catch {
76-
body.filter = {}
76+
throw new Error('Invalid JSON provided for filter')
7777
}
7878
}
7979
if (params.sorts) {
8080
try {
8181
body.sorts = typeof params.sorts === 'string' ? JSON.parse(params.sorts) : params.sorts
8282
} catch {
83-
body.sorts = []
83+
throw new Error('Invalid JSON provided for sorts')
8484
}
8585
}
8686
if (params.limit != null) body.limit = params.limit

‎apps/sim/tools/attio/update_list_entry.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const attioUpdateListEntryTool: ToolConfig<
6262
? JSON.parse(params.entryValues)
6363
: params.entryValues
6464
} catch {
65-
entryValues = {}
65+
throw new Error('Invalid JSON provided for entry values')
6666
}
6767
return { data: { entry_values: entryValues } }
6868
},

‎apps/sim/tools/attio/update_task.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ export const attioUpdateTaskTool: ToolConfig<AttioUpdateTaskParams, AttioUpdateT
7373
? JSON.parse(params.linkedRecords)
7474
: params.linkedRecords
7575
} catch {
76-
data.linked_records = []
76+
throw new Error('Invalid JSON provided for linked records')
7777
}
7878
}
7979
if (params.assignees) {
8080
try {
8181
data.assignees =
8282
typeof params.assignees === 'string' ? JSON.parse(params.assignees) : params.assignees
8383
} catch {
84-
data.assignees = []
84+
throw new Error('Invalid JSON provided for assignees')
8585
}
8686
}
8787
return { data }

‎apps/sim/tools/attio/update_webhook.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const attioUpdateWebhookTool: ToolConfig<
6363
? JSON.parse(params.subscriptions)
6464
: params.subscriptions
6565
} catch {
66-
data.subscriptions = []
66+
throw new Error('Invalid JSON provided for subscriptions')
6767
}
6868
}
6969
return { data }

0 commit comments

Comments
 (0)