How to create an API in Make.com (formerly Integromat)
Did you know that you can create something that works like an API in Make? Have a look at this:
Use webhook
You might think that the webhook module exists to trigger a scenario. That’s partly true. But it can also wait for a custom response. The most fundamental structure would look like this where you catch a webhook then send a response back to it.
If you post to a webhook, you normally see the Accepted text in a new tab. That’s a response in itself, however, we can customize that and send a response with some information. We just have to manipulate values between these two modules in the above image.
Want no-code automation tips and secrets? I got you covered.
Subscribe to my newsletter. Don’t worry. I can’t code either.
Example
This scenario is from the demo video above (95% the same but I added some adjustment). What it does is it takes a URL via webhook, make a request to that URL, then get all the h1, h2, and h3 headings from the source code, and send them back to the request in JSON format.
Let’s try and make a GET request (or it can be POST as well).
https://hook.eu1.make.com/m113w7wsvk9ca4c9wv5daun9kxi3jug9?url=https://webflow.com/blog/third-party-cookie-deprecation
Nice! As you can see, you can send some data via webhook using either query strings or simply placing the data into the request body. A good practice is to think of scenarios as reusable components and always try to make them modular so you can make requests to it from other scenarios in order to expedite your building process.
Moving on, once this scenario receive a request, it makes a request to the URL received and extract headings using the XML > Perform XPath Query module. I won’t get into this as it would be a bit off-track. But if you want to know more about web scraping in Make, I wrote a post solely on the topic, so please have a read!
Finally, this is the response:
{
"h1s": [
"What marketing and web teams need to know about third-party cookie deprecation",
"What marketing and web teams need to know about third-party cookie deprecation"
],
"h2s": [
"What are third-party cookies?",
"What are first-party cookies?",
"What about those accept-our-cookies modals?",
"Google decided it’s time to wave goodbye to third-party cookies",
"How marketing and web teams can prepare for third-party cookie deprecation",
"Subscribe to Webflow Inspo",
"Related articles",
"Get started for free"
],
"h3s": [
"Third-party cookies, however, can cause privacy issues",
"However, the plan is still in beta",
"Start preparing for cookiepocalpyse",
"The marketer’s guide to zero-party data",
"The marketer’s guide to zero-party data",
"5 Web browsers web designers should know how to design for",
"5 Web browsers web designers should know how to design for",
"Preparing for the GDPR",
"Preparing for the GDPR",
"Integrating Google Tag Manager with Google Analytics in Webflow",
"Integrating Google Tag Manager with Google Analytics in Webflow",
"What is affiliate marketing (and how to use it to your advantage)",
"What is affiliate marketing (and how to use it to your advantage)",
"19 major advantages and disadvantages of ecommerce over traditional retail",
"19 major advantages and disadvantages of ecommerce over traditional retail",
"Transforming the design process at"
]
}
Sweet! We’re seeing some duplicates in the output, but if you don’t like that, you can apply deduplicate() function to make them all unique.
Download the template
If you want to see what it exactly does before building, you can try playing around with my webhook URL here:
https://hook.eu1.make.com/m113w7wsvk9ca4c9wv5daun9kxi3jug9?url=https://webflow.com/blog/third-party-cookie-deprecation
Try changing the url parameter to see what comes out.
If you need the scenario template, you can download it on Blueprint: