How Return Data on Sync Webhook works

The ‘Return Data on Sync Webhook’ action enables you to run a workflow by calling a URL (webhook URL) and get the workflow’s output in the body of the URL.

We will understand how this action works with the help of an example.

Example

Let’s say, you have a workflow that creates a board in your Trello account, posts the details of the board on the specified Slack channel, and also sends board details via Email.

Once all the actions have been configured and connected, double-click the Start icon. A new screen will appear containing a list of trigger services. Select Webhook trigger from the list.

On clicking the Webhook trigger, a unique webhook URL will be generated. You can optionally add an extra layer of security to your webhook URL by enabling the webhook authentication option. Click on Next and then on Done to go back to the canvas.

At this point, if you hit this webhook URL in any browser, the workflow will get executed automatically, and you will receive the following response in the browser window:

Now, drag and drop ‘Return Data on Sync Webhook’ as the last action of your workflow. In our example, we will add the action after the ‘Send an email’ action as shown in the image below:

Configure the ‘Return Data on Sync Webhook’ action and insert values in the given fields as per the instructions given below:

Response Headers: Enter the details of a single or multiple headers in a key-value pair format. In our example, since our workflow output is straightforward and don’t require any header details, we haven’t entered the header values. If in your case the application requires this input, you can enter the header details in the required key-value pair format.

Response Data (Mandatory): Add the output of any of the previous actions that you want to retrieve through the webhook. It's possible to add more than one outputs from previous actions in this field. You can select the outputs from the list given on the left hand side of the window. In our example, we will select the board name for the ‘Response Data’ field.

Status code: Enter the status code value that you want to display along with the output. By default the value for this field is set to 200. You can also specify the custom message.

Content Type: Select/specify the content type in which you want to receive the workflow output.

Once you have added this action to your workflow, '?sync=true' will be automatically appended to your webhook URL as shown in the image below.

The ‘Return Data on Sync Webhook’ will sync the workflow with webhook URL and will send the workflow output to it when the Webhook URL is hit.

Now when the Webhook URL is hit, you can see the required board details on the screen.