Automation as we know enables you to automate repetitive tasks that save the time taken to perform them manually. It can be used to automate the execution of workflow like when an event is triggered.
Studio now has the feature to Automate tasks. There are typically two actions to be performed in this trigger and action. The Trigger would be when the event is going to occur and the Action which specifies the action to be executed. It is important to understand that the Automation of tasks is possible only on the Published Apps.
Studio currently offers three trigger options, time-based i.e a Scheduler trigger, sheet based which is the action to be performed based on sheet trigger namely new row added, details updated, and so on. The Webhook based one is mainly used when you have third party services and wish to be notified on a related action.
Now let us first understand here the Webhook based automation with this video here.
Now let us understand here the Webhook based automation. A Webhook is a way for an app to provide other applications with real-time information. A webhook delivers data to other applications as it happens, meaning you get data immediately. For example, for FreshDesk API you can have a webhook that notifies your app every time a new ticket is added. Or say for example for the BOX app, there can be a webhook that notifies your app whenever a file or folder is uploaded, created, deleted or any such actions are taken.
Let us consider a scenario where we would need to send a Slack notification whenever a new file is uploaded to the BOX app. We would be adding the Webhook for BOX service to our Automation. We would have to register our Automation Webhook URL in the BOX Service.
Adding the Webhook based Automation
Let us see how to add the Webhook based Automation. In Studio, select Automation and click +Automation.
Enter the Automation name. Now that we want to add a Webhook based trigger, we need to select the Webhook type and click Continue.
Now, the Webhook based automation involves two steps; Trigger or when this happens and Action or Do this.
Trigger or When this happens
Now for Webhook based Automation, we need to register our Automation Webhook URL with third-party services. Under When this happens > Configure Webhook you can copy the URL from the Webhook URL and paste it in the third-party services register webhook URL section or Send an event to the webhook manually via curl.
So to configure the Webhook, copy the URL to the Third-party service.
In this example, we are going to use the BOX service. Here we have copied the Endpoint URL from the Webhook Automation. Now, whenever any files are uploaded this automation will trigger a Slack message. The JSON body format is supported in Webhook payload. Use the Test Payload which is of the same format as that which will be sent by third party service. To get the actual payload format you can refer to their documentation or alternatively trigger the webhook directly from third party service by performing respective action.
Alternatively, you can also use the CURL to send an event to the webhook manually.
The Webhook configuration is now complete. Now click Done.
Now under Sample Test Data, you would be able to see the last 3 records. This is the data that can be used as a sample for testing in the next steps. Now select the record and click Done. The selected record would be used as input data for testing automation.
The next step is the Action to be taken whenever the Webhook triggers when the action (of file upload in this example) is done.
Now you need to select the task or connector to send a Slack message. Select the appropriate task you need and configure it.
There would be some dynamic values that you want to send. In this case, it is a simple Test value that we are sending. You would get in in the Keywords list. Select the appropriate input variable.
Similar to Sheet based Automation, you can assign data received from a webhook as input to this Input Field. Basically, All the Keys received from the Webhook POST request body received from the third party service will be available to use and shown on-click of the Dropdown icon. Selecting a particular Key will then pass its Value against the selected key as an input to the corresponding input field. You can either pass static values or use the keys created from the test data received via webhook.
You can test the action if you want. Click Test. In this example, a Slack message would be sent to the specified person/s on successful execution of the action.
Now once you are satisfied with the Webhook based automation, click Save. The Automation task created would be listed under the Automations list. After you Publish the automation your status would change to Activated. Note the Status. You can Deactivate it as required.
Thus you can make use of the Webhook-based automation for triggering actions when the Webhook triggers action on certain events like file upload, update the record, and so on.
Note: It is important to remember that for webhook based automation there are some rate limits in place
- 12 requests per min per webhook
- 500 requests per hr per webhook