How to Use Filter to Search and Find Webhooks
For one of the many reasons (monitor, troubleshoot, retry,etc) you want to find a specfic webhooks or a set of webhooks.
In this guide, you will learn how to leverage the filters in Events View. Knowing how to use filters helps you monitor webhooks, find the webhook you are searching for, and leverage the bulk retry functionality. In this article we will cover the benefits of each filter; we will also look at simple examples of bulk retry, followed by a use case that illustrates what it looks like when we implement the filters covered in this guide.
How To Use Filters
Hookdeck offers many filters that can be combined for a better experience. It's recommended to use multiple filters to narrow your search as much as possible.
Applying filters
- Select a filter.
- Set the filter.
- Click "Apply Filters" or click outside the filter box to apply.
Clearing filters
You can either individually remove a filter or select "Clear All."
What are the filters
1) Date
The Date
filter narrows your result to find webhooks in a specific time range. Something to note is that a date starts at 00:00 of that day.
- To search a single day, select the desired day as the
Start date
and the next day as theEnd date
. - To search a range of dates, select the desired start date as the
Start date
and the desired last day, plus one extra day, for theEnd date
.
For example, here we are looking for webhooks between the 11th of June 2021, 00:00 and the 12th of June 2021, 00:00. Notice that in this example, the search would not reveal webhooks received on the 12th of June.
To change dates, you need to click "Reset dates" and then select a new time range.
2) Request
The Request
filter narrows your results based on element(s) in the header, body, query or path. This filter is great when you want to be extremely precise in your search; one popular use case is filtering using an ID. Something to note is that you do not need to specify the entire payload. All you need is the snippet of the subset you are looking for, because the filter is a partial match.
This filter requires knowledge on how to use our JSON filtering syntax. You can learn more about it [here.](https://hookdeck.com/docs/filters#filter-syntax)
Header
Filter webhooks using a value in the header.
For example, here we searching for webhooks that have {"x-shopify-topic": "carts/create"}
in their header.
Body
Filter webhooks using a value in the request body.
For example, here we are searching for webhooks that contain 12345678 in their ID.
Query
Filter webhooks using a value in a query.
For example, here we are searching for webhooks that have the query friend = yes
.
Path
Filter webhooks using the path.
For example, here we are searching for webhooks that have been delivered to the path /prod-deploy
.
3) Connection
The Connection
filter narrows your webhook search based on its connection. This filter is great for troubleshooting specific integrations.
For example, here we are searching for webhooks that are linked to the connection Github -> Deploy
.
4) Source
The Source
filter narrows your webhook search based on its source. This filter is great for troubleshooting by API provider.
For example, here we are searching for webhooks that are coming from the source Shopify
.
5) Destination
The Destination
filter narrows your result based on the webhook's destination. This filter is a great option for troubleshooting per API.
For example, here we are searching for webhooks that are sent to the destination My API
.
6) Status
The Status
filter narrows your result based on the status of the webhook. This filter is a great option if you want to monitor the overall state of your webhooks.
There are two ways to set this filter.
- The filter box.
- The event status tab on the left sidebar.
In both of these examples, we are searching for webhooks that have a Failed
status.
When you have selected a status using the left side bar, your status filter will not be cleared even if you click "Clear All Filters." You have to select the Events
tab to remove the status filter.
7) HTTP Code
The HTTP Code
filter narrows your result based on the HTTP code of the webhook request. This filter is great if you want to monitor and better understand what kind of issues are happening.
- For a specific HTTP Code, enter the same HTTP Code in both the "Min" and "Max" fields.
- For a range of HTTP Code, enter the lower bound HTTP Code in the "Min" field and the upper bound HTTP code in the "Max" field.
- When you leave a field empty, it will assume by default the lowest value for "Min" and the highest value for "Max."
The HTTP Code displayed is what your server is returning to Hookdeck.
For example, here we are searching for webhooks that have an HTTP Code of 422 and above (the search will include 500's).
8) CLI Users
The CLI Users
filter narrows webhooks by selecting the user's name. This filter is great when you want to isolate your webhooks from the other webhooks that are sent to users also using the CLI.
This filter is only available in the CLI view.
For example, here we are searching for webhooks that are sent to the user's (my) CLI.
Filters with Bulk Retry
Clicking the bulk retry button means retrying many webhooks at once. You can apply filters to specify the parameters of the webhooks you want to bulk retry.
Example of a bulk retry without specifying a filter:
Example of a bulk retry with filters on the date and on the connection:
Filtering to search webhooks tutorial
With all of these filtering options, it's simple to monitor and search for the webhook you are looking for, and bulk retry the exact webhooks you want! Let's go through an example on how to leverage the filters in a more complex use case.
In this example, Goku is sending webhooks to Piccolo and Chichi. We are going to search for webhooks that have been received on June 12th with an ID of 12345678 from Goku to Piccolo (connection), and an HTTP code of 422. This is my current list of events:
1) Date filter
I'm setting the date range so that it captures the 12th of June 2021 exactly.
2) Request body filter
I'm setting the filter for the body request to id:12345678
.
3) Connection filter
I'm setting the connection filter to Goku → Piccolo
.
4) HTTP Code Filter
I'm setting the HTTP code filter to 422.
5) Result
Great! We are only seeing webhooks events that:
- are on June 12th, 2021,
- have an id of 12345678,
- are from Goku to Piccolo, and
- with an HTTP Code that is 422.
6) Bulk Retry
Once we have finished these steps, we can re-apply the same filters to bulk retry the webhooks.
And that's it! Happy coding!