Problem:
When you trigger a Webhook (in Webflow) on a CMS Collection, it triggers on all CMS Collections, not any specific one.
Any create, update, or delete on any item, across all of your CMS Collections triggers a Webflow Webhook
Webflow doesn’t give you granular control with their Webhooks.
So you end up getting a firehose of data sent out of Webflow via their Webhooks.
Because of this…
Someone recently asked me a question (a.k.a. @johnematias):
"I’ve successfully set up a Webflow Webhook to get data when any of my Webflow CMS items change, but how do I narrow it down to a specific Webflow CMS Collection?”
And my first thought was a Make Automation
Solution:
Turns out…
If you’re sending data to a Make Webhook its super easy to apply a Data Structure and filter requests BEFORE your operation runs.
Versus the common choice of applying a filter that runs AFTER your operation.
I found this solution to work really well for me and I wanted walk through a quick build of how I solved the problem with Make Webhooks and Data Structures.
Hopefully it helps someone else!
The Build:
Starting with Webflow.
The first thing to do is…
1. Create a Webflow CMS Collection
Next add a new field with the same name as the Collection.
This field will be the key you bind to, and filter on, with your Make Data Structure.
2. Create your Make Webhook
Just a standard Make Webhook will do for now. The important part at this phase is to get the Make Webhook URL so we can add it to Webflow.
3. Create your Webflow Webhook
With your Make Webhook URL, you can now use it to create a Webflow Webhook.
I set my trigger on a CMS item being updated.
Whenever a Webflow CMS item is updated (in any Collection) your Webflow Webhook will be triggered and the item will be sent to Make.
4. Create your Data Structure as a Filter
Next, setup your Data Structure within your Make Webhook.
I’ve added the Webflow CMS field I created earlier as the Data Structure key I want to match against.
If I have 2 Webflow CMS Collections, each will have a unique field (key) the same name as the Collection.
Any request without that specific key (field from your Webflow CMS) will be blocked.
If the key exists, it’ll run your Webhook operation.
That’s because…
I’ve set this specific item to be required.
If this item, within this Data Structure does not exist in the requested data sent to it, then it blocks it BEFORE running my Webhook operation.
5. Try it!
Test the happy path…
Tap the magical run once button, update your Webflow CMS Collection, and see it run.
Also confirm that this has the Webflow CMS field sent to it that exactly matches the key in your Make Data Structure.
Test the sad path…
Tap the run once button again, update a Webflow CMS Collection that does not have this key in it, and see that the Webhook operations never runs.
Go to your Scenario history and see that you have only 1 run, your second attempt never ran.
Conclusion
This has worked really well for me.
I can freely change my Webflow CMS structure, as long as I leave this one field, without it effecting my Make Webhook Data Structure.
Post any questions!
P.S. here’s my original blog post if anyone is interested.