If you’re just starting your adventure with Zapier, Webhooks can seem a little bit complicated.
After all, wasn’t Zapier automation supposed to help you AVOID using any kind of HTTP connections or other code-like stuff?
The thing is, while Zapier is a real automation powerhouse, there’s a limit to the number of apps that it can connect with.
Sure, with several thousands of third-party apps to choose from, it gives you more options than any of its direct competitors.
Still, there are tens of thousands of apps that lack official Zapier integrations.
Moreover, those that do have an integration sometimes lack certain features that your workflow may need. Features that you can access with the use of a webhook.
In this foundational guide to Zapier webhooks, we’ll look at what a webhook is and its benefits. We’ll also explain the difference between a webhook and an API. Lastly, we’ll look at how to use the Webhooks by Zapier app and the sample things that you can do with it.
So, let’s kick things off by looking at what exactly is a webhook.
What Is a Webhook?
In non-technical terms, a webhook is a way to deliver data from one application to another via a special URL.
It allows you to receive data from any third-party app or send requests to specific URLs. All that without having to write complicated code (although you need a little bit of it, for example, to serialize data).
It can be compared to sending a text message to your friend’s phone number.
But, in place of your friend, there’s an app, and in place of a phone number, we’re using a webhook URL.
Most webhooks send data – also called a payload – in one of three ways. To illustrate them, we’ll use an appointment example. Imagine one of your customers just scheduled the following appointment:
- Customer name: Frank
- Customer last name: Sinclair
- Date: 20th of February
- Time: 10:00 AM
- Duration: 20 minutes
- Type: Discovery call
Now, let’s look at what the above data would look like in different data formats:
- Form-Encoded HTTP Request.
The form-encoded HTTP request adds data at the end of the url – after the question mark:
https://yourbookingapp.com/appointments/meeting123?clientname=frank&clientlastname=sinclair&month=feb&day=21&time=1000&duration=20&type=discovery
- XML (Extensible Markup Language)
A simple structured data format often used for representing structured information. It can be used to transfer all kinds of data including documents, invoices, or transaction details.
Here’s what the same data would look like as an XML payload:
<app>
<clients>
<client name="Frank" lastname="Sinclair">
</clients>
<meetings>
<meeting day= "20" month = "February" time="10:00" duration="20" type="discovery">
</meetings>
</app>
- JSON (JavaScript Object Notation)
A human-readable data format for sending data between applications. Arguably the most popular and convenient when used with Webhooks. Here’s an example of that same payload in JSON format:
[ { "Client": { "name": "Frank" "last name": "Sinclair" } "Meeting": { "day": "20", "month": "February", "time": "10:00" "duration": "20" "type": "discovery" }
}]
If you’ve never tried playing with webhooks, you can perform a free test in the webhook.site testing environment. The tool generates a unique webhook URL which you can use to test HTTP requests and see whether your application sends data the way you want it to:
It’s also a great place to get your feet wet or test your HTTP request before you proceed to automate things. But, before we get to do that, let’s look at the differences between webhooks and APIs.
Webhook vs API
When talking about apps communicating with each other, we can’t forget about APIs. In fact, API (Application Programming Interface) and webhooks are often mistaken for one another.
But, despite certain similarities (a webhook can be compared to a lightweight API), there’s a significant difference between the two.
Unlike a webhook, an API enables two-way communication between two applications. Most importantly, the communication is request-driven. This means one app has to first send a request before it receives anything back.
App B can then send a response or, if app B isn’t authorized to receive the response (or app B cannot provide it), it will respond with an error message. This is known as a request-response cycle – below is its very simplified version:
Of course, this is a very simple explanation – but, it should be enough to help you understand the differences. So, what about webhooks?
Compared to an API, when using a webhook, app A doesn’t have to send a request for data. Instead, app B can send the data whenever an event happens.
This means that a webhook can be thought of as a reverse API. To better explain this concept – let’s look at common webhook use cases.
Common Webhook Use Cases
While webhooks have certain limitations, where they shine is sending event-driven notifications.
For example, imagine you want to get a Slack notification whenever somebody starts a chat conversation on your website. With a polling API, Slack would have to keep asking your chat app for new chat conversations.
But, if you use a webhook instead, Slack will receive a notification each time there’s a new conversation happening. Thanks to that, Slack doesn’t have to waste resources on sending repetitive requests. Other use cases may include:
- Adding a new subscriber to your CRM or sales management system
- Updating or adding customer data to a Google Spreadsheet
- Sending a Slack notification whenever there’s a new purchase
- Receiving notifications about new Tweets or mentions
- Notifying your accounting software about paid invoices
- Receiving alerts about low supply of a given product
Now that you know the common use cases of a webhook, let’s quickly look at their advantages and drawbacks.
The Benefits of Using Webhooks
By now, you might have already noticed a couple of benefits of using a webhook. Here’s a recap of the most important one:
- They are easier to set up. Compared to a full-scale API, the process of developing a webhook is much faster. In some cases, developing an API can be as challenging as developing the application itself. With a webhook, you can have the connection up and running in a fraction of that time.
- They are less resource intensive. Both the implementation and the functioning of a webhook require fewer resources. This makes them an ideal choice for sending simple data, where an API would be an overkill.
- They allow you to send data faster. This one won’t always be the case. Usually, it will depend on the alternative connection and the type of data that you’re looking to send. However, if your connection is data-driven, then with a webhook, the app can trigger data transfer the moment an event happens. With a polling API, app A would have to send regular requests to app B, looking for new information.
The Drawbacks of Using Webhooks
Of course, there are also certain drawbacks to using a webhook:
- If the data that the webhook delivers changes, you have to reconfigure it to listen for a different event. Often, it’s easier to just create a new webhook. The upside is, they’re usually not as resource-intensive to do either.
- When using an API, apps can share data with multiple endpoints. This means that your app will have access to much more data compared to a webhook.
- Webhooks do not allow the sending system to add, update, or delete data on the receiving end. As a result, they are essentially a one-way form of communication.
Still, despite those drawbacks webhooks are useful in many different situations. This includes your Zapier workflows. Speaking of which – let’s take a quick look at the Webhook by Zapier app.
What Is the Webhook by Zapier App?
The Webhooks by Zapier integration is a simple way to incorporate webhooks into your Zap.
The integration allows you to collect data from (or send data to) thousands of applications. It also lets you make simple API calls (more on that later).
Lastly, if the app allows that, it can be used to go beyond what’s possible with the official Zapier integration.
Now, let’s look at the available options that are built into the Webhooks by Zapier app.
Available Webhooks by Zapier Triggers
When it comes to triggering your Zaps, the Webhooks by Zapier built-in integration gives you three different triggers:
- Retrieve Poll. This trigger is a bit controversial as it’s not really a webhook and doesn’t work instantly. Rather than waiting for a new data payload, you ask Zapier to keep polling a URL looking for new entries.
- Catch Raw Hook. It allows you to accept POST, PUT, and GET requests via a Zapier URL. It then returns unparsed data from the trigger app.
- Catch Hook – the trigger that you’ll use the most. It’s similar to the above – the main difference is, you’ll receive parsed data. Parsed data means you can easily map it in the next action steps. We’ll compare the results of Catch Hook and Catch Raw Hook later in the article.
Available Webhooks by Zapier Actions
Now, what if you want to send data obtained in a Zap to another app via Webhook? That’s where Webhooks by Zapier action steps come in. Here are the four available action events, which are also HTTP methods:
- Custom Request. The custom request is used to send extremely customized headers, empty values, or a nested JSON array. It’s also necessary if you want to use the PATCH or DELETE HTTP methods. Keep in mind that with a custom request, you need to be 100% sure your webhook configuration is excellent.
- GET requests have their payload appended to the URL as a query string. They are used to read or retrieve a resource. A successful GET request returns the requested information. For example, you could use a GET request to retrieve the current stock price.
- POST requests carry the payload in the request body (in JSON or XML format). They may also contain additional properties such as authentication tokens. This can be used to add new stocks to your wallet in a finance tracking app.
- PUT request is used to modify the resource by updating it with the carried data. For example, you could use it to update stock transaction data in your finance tracking app.
While the choice may sound overwhelming, in a typical setup, 90% of workflows use the POST request.
Now that we’ve reviewed the theory, it’s time to take a closer look at how it all works in practice. Let’s start that by setting up a Webhook-triggered Zap.
Setting Up a Zap Triggered by a Webhook
In this sample Zap, we’ll use Postman to send JSON serialized data to our Zap. We’ll then map that data to a Google worksheet. First, open Zapier, select Webhooks by Zapier as your trigger, and select “Catch Hook”:
Next, you can select whether you want to pick off a child key. This allows you to send only certain elements from the data object sent to Zapier.
In our example, we’ll send a very small data object, so we can skip that part entirely.
Next, you’ll receive a webhook URL which you can use to send the data. When setting the Zap, copy the URL and enter it in the application that you want to use to trigger your workflow:
If you’re using Postman for testing, you want to copy the URL next to the HTTP method drop-down:
Now, before we hit send, let’s look at the data that we’re using. Imagine that we ordered 5 yellow bikes at 499.00 a bike, for a total of 2495.00:
Now, hit send and then test the trigger in Zapier. Here’s what the data looks like inside Zapier trigger test results:
Now, let’s move that data to a spreadsheet. As you can see, because the data was serialized, we can easily map it to the right columns inside Google Sheets.
Of course, you probably won’t always receive data objects with keys identical to column names. In this example, I did that to better illustrate the setup:
Next, hit continue and test the action. Here’s what the data looks like once it’s sent to a Google Sheets worksheet:
Now you know how to trigger a Zap using a Webhook (and use that data in a Zap). It’s time to look at what the Webhooks by Zapier action looks like in practice.
Sending Data to a Webhook
This time, we’ll send data from Google sheets to a webhook. To do that, we need to set a Google Sheets trigger. We’ll use the same worksheet as in the previous example. But this time, we want to use the New Spreadsheet Row in Google Sheets trigger:
Because we used the same worksheet as in the previous example, the data will come in the same format:
Next, let’s use the Webhooks by Zapier actions. First, select POST as our action event:
Then, it’s time to configure the step:
- In the URL section, enter the Webhook URL you’re going to use
- For payload type, select whether you want to send a form-encoded payload, a JSON, XML, or raw. We’ll use JSON.
- For data, enter the key-value pairs that you’re sending. In the below example, keys follow spreadsheet headers. Then, we mapped spreadsheet values to the right keys.
Because we’re not wrapping the request in an array or attaching any files, we can skip the next two steps:
Also, because we’re using a test webhook, we don’t need to set any authentication or attach any extra headers:
Now, let’s test what the data looks like inside our webhooks.site panel. As you can see, it arrived formatted in JSON – the same as the payload type that we chose:
And that’s it! Now you know how to transfer data to and from Zapier using Webhooks.
Start Using Webhooks in Your Zapier Automation
The above was just a foundational guide – and there’s a lot more you can do with Webhooks and Zapier. Most importantly, you can use Webhooks by Zapier to connect one of the thousands of apps that lack the official Zapier integration.
The setup presented in this article was quite basic as it didn’t even require authentication.
Thankfully, most setups don’t go much beyond what was presented. That’s unless you need to transfer complex data payloads.
Still, if you need help configuring webhooks in your Zapier workflow, don’t hesitate to reach out.
Either leave a comment below describing your problem or head over to this page and shoot me a message. You can also use the built-in calendar to schedule a discovery call to discuss your business and automation needs.
Hey, I’m Jacek. I’m the founder and Chief Automator at Clickleo.com
I’m on a mission to help you use automation to reclaim your time and achieve more in your business.
You can find out more about me – and why I started Clickleo – over on this page
Comments
Powered by WP LinkPress