Send Bulk Notifications with Webhooks
This document will outline how to use the webhook stage, integrated with Zapier to only notify reviewers when a certain number of images have passed through the webhook stage.
Why is this useful
Webhooks allow you to relay information in real-time, allowing for higher efficiency and automation. In advanced workflows containing a number of stages, each with different annotators assigned to, it's important to automate the process of notification when images have reached different stages of the workflow. For example, in the below image, reviewers will be notified when images have reached the review stage, through the preceding webhook stage, rather than manually needing to check themselves.
Additionally, with projects and datasets containing a large number of images, notification on every image/video can be distracting and not very useful. Instead it would be more useful to notify reviewers when a bulk number of images have moved through the webhook stage. We will go through how to do this using Zapier step-by-step in the section below.
Steps
- In Zapier, create a new zap, and set the Trigger to 'Catch Raw Hook in Webhooks by Zapier'. This step will produce a Webhook URL, which we will use as the URL in Darwin when we connect the webhook stage. More information on webhooks can be found here.
- We next, want to connect this trigger with an action, to populate the rows of a Google Sheets, each time the webhook is triggered. This keeps track of the items passing through the webhook stage, without generating a notification straight to the reviewer. You can either use an existing Google sheet, or create a new one for this purpose, making sure that the account the sheet is linked to is specified. The 'Raw Body' using the trigger above will then be used as the data in each row.
- The second action we need to set-up in our Zap, is the 'Formatter', using the 'Numbers' event. This will allow us to add a formula to the output received from the Google sheets. In our case, we want to use the speadsheet-style formula Transform available, to calculate the modulus of the number of rows in the spreadsheet by a second number. This second number will be based on how often we want the notifications to be sent. In the below image, any number of rows which is a multiple of two will output zero from the formula. We can modify this number to 50, 100, etc if we want the notification to happen based on every 50 or 100 items moving through the webhook stage respectively.
- The next action in the Zap will be a rule-based stage, where we use the built-in Filter by Zapier action, to determine if the output of the previous stage is equal to 0 or not. The Zap will only continue if this criteria is satisfied.
- Finally, if the output passes the criteria, meaning the number of rows in the spreadsheet (equivalent to the number of items passed through the webhook stage) is a multiple of X, we can send a notification to the required reviewers, either through Slack, email or another messaging service. It's important to make sure the correct account is set-up, and the message sent can be modified accordingly to the required need.
Demo
Below is an end-to-end demo of the steps above, shown for an example dataset.
Updated 12 months ago