Skip to content

Commit 237bb41

Browse files
committed
fix(integrations): keep Mailchimp Update Audience behavior as on main, throw on invalid Attio entry values, and guard the ServiceNow CI class path
1 parent 266a184 commit 237bb41

6 files changed

Lines changed: 11 additions & 48 deletions

File tree

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ Update an existing audience (list) in Mailchimp
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"\}\) |
118118
| `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"\}\) |
120119

121120
#### Output
122121

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

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -647,24 +647,10 @@ Return ONLY the JSON object - no explanations or markdown.`,
647647
},
648648
condition: {
649649
field: 'operation',
650-
value: ['create_audience'],
650+
value: ['create_audience', 'update_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-
},
668654
// Member fields
669655
{
670656
id: 'subscriberEmail',
@@ -1753,10 +1739,8 @@ Return ONLY the JSON array - no explanations or markdown.`,
17531739
return `mailchimp_${params.operation}`
17541740
},
17551741
params: (params) => {
1756-
const { apiKey, operation, updateEmailTypeOption, ...rest } = params
1742+
const { apiKey, operation, ...rest } = params
17571743
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
17601744

17611745
Object.entries(rest).forEach(([key, value]) => {
17621746
if (value !== undefined && value !== null && value !== '') {
@@ -1770,10 +1754,6 @@ Return ONLY the JSON array - no explanations or markdown.`,
17701754
inputs: {
17711755
operation: { type: 'string', description: 'Operation to perform' },
17721756
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-
},
17771757
},
17781758
outputs: {
17791759
success: { type: 'boolean', description: 'Operation success status' },

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const attioCreateListEntryTool: ToolConfig<
6868
? JSON.parse(params.entryValues)
6969
: params.entryValues
7070
} catch {
71-
entryValues = {}
71+
throw new Error('Invalid JSON provided for entry values')
7272
}
7373
}
7474
const data: Record<string, unknown> = {

‎apps/sim/tools/mailchimp/mailchimp.test.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,12 @@ describe('Mailchimp campaign and audience requests', () => {
150150
).toMatchObject({ template: { id: 42 } })
151151
})
152152

153-
it('leaves email_type_option unchanged when blank and sends contact details', () => {
153+
it('sends a boolean email_type_option from an agent as true', () => {
154154
const body = bodyOf(mailchimpUpdateAudienceTool, {
155155
apiKey,
156156
listId: 'list1',
157-
emailTypeOption: '',
158-
contact: '{"company":"Acme","city":"NYC"}',
157+
emailTypeOption: true,
159158
})
160-
expect(body).not.toHaveProperty('email_type_option')
161-
expect(body).toMatchObject({ contact: { company: 'Acme', city: 'NYC' } })
159+
expect(body).toMatchObject({ email_type_option: true })
162160
})
163161
})

‎apps/sim/tools/mailchimp/update_audience.ts‎

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ export interface MailchimpUpdateAudienceParams {
1313
audienceName?: string
1414
permissionReminder?: string
1515
campaignDefaults?: string
16-
emailTypeOption?: string
17-
contact?: string
16+
emailTypeOption?: string | boolean
1817
}
1918

2019
export interface MailchimpUpdateAudienceResponse {
@@ -75,13 +74,6 @@ export const mailchimpUpdateAudienceTool: ToolConfig<
7574
visibility: 'user-or-llm',
7675
description: 'Support multiple email formats: "true" or "false". Omit to leave it unchanged',
7776
},
78-
contact: {
79-
type: 'string',
80-
required: false,
81-
visibility: 'user-or-llm',
82-
description:
83-
'JSON object of contact information (e.g., {"company": "Acme", "address1": "123 Main St", "city": "NYC", "state": "NY", "zip": "10001", "country": "US"})',
84-
},
8577
},
8678

8779
request: {
@@ -100,15 +92,6 @@ export const mailchimpUpdateAudienceTool: ToolConfig<
10092
if (params.emailTypeOption !== undefined && params.emailTypeOption !== '')
10193
body.email_type_option = String(params.emailTypeOption) === 'true'
10294

103-
if (params.contact) {
104-
try {
105-
body.contact =
106-
typeof params.contact === 'string' ? JSON.parse(params.contact) : params.contact
107-
} catch {
108-
throw new Error('Contact must be a JSON object')
109-
}
110-
}
111-
11295
if (params.campaignDefaults) {
11396
try {
11497
body.campaign_defaults = JSON.parse(params.campaignDefaults)

‎apps/sim/tools/servicenow/search_cis.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from '@/tools/servicenow/utils'
1515
import { SERVICENOW_CREDENTIAL_OAUTH } from '@/tools/shared/saved-credentials'
1616
import type { ToolConfig } from '@/tools/types'
17+
import { safeUrlPathSegment } from '@/tools/url-path'
1718

1819
export const searchCisTool: ToolConfig<ServiceNowSearchCisParams, ServiceNowRecordListResponse> = {
1920
id: 'servicenow_search_cis',
@@ -51,7 +52,9 @@ export const searchCisTool: ToolConfig<ServiceNowSearchCisParams, ServiceNowReco
5152
request: {
5253
url: (params) => {
5354
const baseUrl = normalizeInstanceUrl(params.instanceUrl)
54-
const table = params.ciClass?.trim() || SERVICENOW_TABLES.CI
55+
const table = params.ciClass?.trim()
56+
? safeUrlPathSegment(params.ciClass, 'ciClass')
57+
: SERVICENOW_TABLES.CI
5558
const searchParams = new URLSearchParams()
5659
appendReadParams(searchParams, {
5760
query: buildEncodedQuery(

0 commit comments

Comments
 (0)