With Custom Actions, it is possible to create a workflow out of a set of actions that are executed whenever a Webhook.site URL receives a request or email.
Using this functionality, you can connect APIs that aren't compatible, convert a HTTP request to an email or vice versa, build workflows that would otherwise require a developer, and much, much more.
JSONPath and Google Sheets¶
In the following demo, webshop order details are received in a webhook. We then use Extract JSONPath and Google Sheets actions to insert their name in a Google Sheet. It also shows how variables interact with downstream actions.
If you use the same set of Custom Actions often, you can create a Template that contains a copy of one or more Custom Actions, along with a set of Predefined Variables.
You can then use this template by creating an Import Template action.
Creating a Template¶
To create a Template, click the Create Template button at the bottom of the Custom Actions overlay. Then enter a name for the template and select which actions should be copied to the template. If your template actions e.g. depend on variables pre-existing, like configuration data, you can add one or more Predefined Variables. These are available to the actions in the Template, but also to any subsequent actions coming after the Import Template action.
Predefined Variables can be updated in the Control Panel.
Changes to the actions that the Template was created from do not automatically carry over to the template. Instead, Templates can be updated post-creation by overwriting them with a new set of actions.
Templates can also be managed using the Template API.
Webhook.site allows some action types to be repeating, which makes Webhook.site "loop over" one or more values without needing to use scripts.
Currently, repetition is only supported by the Extract JSONPath and Extract Regex action types.
Currently, the maximum amount of items that are supported is 100 to prevent abuse. This limit may be raised in the future. Items above that are ignored.
The repeating action should be ordered before the actions that are to be repeated. The actions that are repeated will run for each item that is extracted, using the same variable name.
By checking the Queued checkbox when creating a Custom Action, Webhook.site will run that specific action in a background queue (asynchronously).
This is useful when you need your Webhook.site URL to respond quickly, but your Custom Actions are taking a long time to run. For example, if your Webhook.site URL should respond in 5 seconds, but you need to call an endpoint with a HTTP Request action that responds in 10 seconds, you can queue the HTTP Request action.
Additionally, you can specify an amount of seconds to wait until the action is executed. To do this, enter an amount of seconds in the Seconds textbox next to the Queue checkbox.
As the a queued action will inherit the execution scope up until the action, there are a few things to be aware of when using Queued Actions:
- Only variables defined in actions ordered before the queued action will be available to the action.
- Variables defined by a queued action are not available to non-queued actions coming after it. You cannot, for example, mark a HTTP Request action as queued and use the response in a Modify Response action.
- If you mark several Custom Actions as queued, and their delay time is identical, variables will be passed down between them.
- The amount of time until the queued action is executed can vary by a few seconds.
- If you have several actions marked as queued, they will execute in order.