Skip to content

Commit a3d529d

Browse files
committed
added form submission trigger to webflow
1 parent 9336ea7 commit a3d529d

File tree

5 files changed

+37
-7
lines changed

5 files changed

+37
-7
lines changed

apps/sim/blocks/blocks/webflow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export const WebflowBlock: BlockConfig<WebflowResponse> = {
127127
...getTrigger('webflow_collection_item_created').subBlocks,
128128
...getTrigger('webflow_collection_item_changed').subBlocks,
129129
...getTrigger('webflow_collection_item_deleted').subBlocks,
130+
...getTrigger('webflow_form_submission').subBlocks,
130131
],
131132
tools: {
132133
access: [

apps/sim/lib/webhooks/processor.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,20 @@ export function shouldSkipWebhookEvent(webhook: any, body: any, requestId: strin
251251
}
252252
}
253253

254+
// Webflow collection filtering - filter by collectionId if configured
255+
if (webhook.provider === 'webflow') {
256+
const configuredCollectionId = providerConfig.collectionId
257+
if (configuredCollectionId) {
258+
const payloadCollectionId = body?.payload?.collectionId || body?.collectionId
259+
if (payloadCollectionId && payloadCollectionId !== configuredCollectionId) {
260+
logger.info(
261+
`[${requestId}] Webflow collection '${payloadCollectionId}' doesn't match configured collection '${configuredCollectionId}' for webhook ${webhook.id}, skipping`
262+
)
263+
return true
264+
}
265+
}
266+
}
267+
254268
return false
255269
}
256270

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,13 +1455,7 @@ export async function createWebflowWebhookSubscription(
14551455
url: notificationUrl,
14561456
}
14571457

1458-
if (collectionId && webflowTriggerType.startsWith('collection_item_')) {
1459-
requestBody.filter = {
1460-
resource_type: 'collection',
1461-
resource_id: collectionId,
1462-
}
1463-
}
1464-
1458+
// Note: Webflow API only supports 'filter' for form_submission triggers.
14651459
if (formId && webflowTriggerType === 'form_submission') {
14661460
requestBody.filter = {
14671461
resource_type: 'form',

apps/sim/triggers/webflow/collection_item_created.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const webflowCollectionItemCreatedTrigger: TriggerConfig = {
2424
{ label: 'Collection Item Created', id: 'webflow_collection_item_created' },
2525
{ label: 'Collection Item Changed', id: 'webflow_collection_item_changed' },
2626
{ label: 'Collection Item Deleted', id: 'webflow_collection_item_deleted' },
27+
{ label: 'Form Submission', id: 'webflow_form_submission' },
2728
],
2829
value: () => 'webflow_collection_item_created',
2930
required: true,

apps/sim/triggers/webflow/form_submission.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ export const webflowFormSubmissionTrigger: TriggerConfig = {
2424
requiredScopes: [],
2525
required: true,
2626
mode: 'trigger',
27+
condition: {
28+
field: 'selectedTriggerId',
29+
value: 'webflow_form_submission',
30+
},
2731
},
2832
{
2933
id: 'siteId',
@@ -34,6 +38,10 @@ export const webflowFormSubmissionTrigger: TriggerConfig = {
3438
required: true,
3539
options: [],
3640
mode: 'trigger',
41+
condition: {
42+
field: 'selectedTriggerId',
43+
value: 'webflow_form_submission',
44+
},
3745
fetchOptions: async (blockId: string) => {
3846
const credentialId = useSubBlockStore.getState().getValue(blockId, 'triggerCredentials') as
3947
| string
@@ -95,6 +103,10 @@ export const webflowFormSubmissionTrigger: TriggerConfig = {
95103
description: 'The ID of the specific form to monitor (optional - leave empty for all forms)',
96104
required: false,
97105
mode: 'trigger',
106+
condition: {
107+
field: 'selectedTriggerId',
108+
value: 'webflow_form_submission',
109+
},
98110
},
99111
{
100112
id: 'triggerSave',
@@ -103,6 +115,10 @@ export const webflowFormSubmissionTrigger: TriggerConfig = {
103115
hideFromPreview: true,
104116
mode: 'trigger',
105117
triggerId: 'webflow_form_submission',
118+
condition: {
119+
field: 'selectedTriggerId',
120+
value: 'webflow_form_submission',
121+
},
106122
},
107123
{
108124
id: 'triggerInstructions',
@@ -124,6 +140,10 @@ export const webflowFormSubmissionTrigger: TriggerConfig = {
124140
)
125141
.join(''),
126142
mode: 'trigger',
143+
condition: {
144+
field: 'selectedTriggerId',
145+
value: 'webflow_form_submission',
146+
},
127147
},
128148
],
129149

0 commit comments

Comments
 (0)