Skip to content

Commit e8cd0a3

Browse files
committed
fix(attio): wrap webhook body in data object and include required filter field
1 parent ebd6f90 commit e8cd0a3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

apps/sim/lib/webhooks/provider-subscriptions.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,15 +1017,15 @@ export async function createAttioWebhookSubscription(
10171017

10181018
const { TRIGGER_EVENT_MAP } = await import('@/triggers/attio/utils')
10191019

1020-
let subscriptions: Array<{ event_type: string }> = []
1020+
let subscriptions: Array<{ event_type: string; filter: null }> = []
10211021
if (triggerId === 'attio_webhook') {
10221022
const allEvents = new Set<string>()
10231023
for (const events of Object.values(TRIGGER_EVENT_MAP)) {
10241024
for (const event of events) {
10251025
allEvents.add(event)
10261026
}
10271027
}
1028-
subscriptions = Array.from(allEvents).map((event_type) => ({ event_type }))
1028+
subscriptions = Array.from(allEvents).map((event_type) => ({ event_type, filter: null }))
10291029
} else {
10301030
const events = TRIGGER_EVENT_MAP[triggerId]
10311031
if (!events || events.length === 0) {
@@ -1034,12 +1034,14 @@ export async function createAttioWebhookSubscription(
10341034
})
10351035
throw new Error(`Unknown Attio trigger type: ${triggerId}`)
10361036
}
1037-
subscriptions = events.map((event_type) => ({ event_type }))
1037+
subscriptions = events.map((event_type) => ({ event_type, filter: null }))
10381038
}
10391039

10401040
const requestBody = {
1041-
target_url: notificationUrl,
1042-
subscriptions,
1041+
data: {
1042+
target_url: notificationUrl,
1043+
subscriptions,
1044+
},
10431045
}
10441046

10451047
const attioResponse = await fetch('https://api.attio.com/v2/webhooks', {

0 commit comments

Comments
 (0)