Capture and test payload data using Webhook Zibots and JSONata expressions

Dina Bennett
Dina Bennett
  • Updated

You can use a Webhook Zibot to capture payload data from Ziflow flows and test that data using the JSONata Exerciser. This is useful for:

  • Debugging failed flows
  • Understanding the data Ziflow sends during a flow
  • Building JSONata expressions that can be used to reference specific payload fields

Note on terminology:
In Ziflow documentation, Ziflow Tokens are placeholders you can insert into flows, templates, or notifications to display dynamic content (for example, {proof.name}).
To avoid confusion, this page uses JSONata expressions to refer to developer-level references to specific data fields within a flow’s payload.

 

Capture data payload

Test payload data with the JSONata Exerciser

Save and share your work

Additional resources

 

Capture data payload

A Webhook Zibot lets you “listen” to the raw data that Ziflow sends when an event or Zibot executes and capture the full payload for the flow (e.g., intake form processing or Zibots with desired data output). The payload will appear in your webhook.site log. 

🔐 Security reminder: This method is for testing only. Protect production data by using an API key or secure login for real integrations.

In the example below, we will capture the response from the Decision made on Proof - Accepted event.

 

Failed flow in Ziflow
Decision made on Proof - Accepted / Flow

 

  1. Create or edit a flow.
  2. Add a Webhook Zibot at the point in the flow where you want to capture data.
    If you’re troubleshooting a failure, add the Webhook Zibot before the failing Zibot so you can see the payload.
  3. Configure the Webhook Zibot:
    Set Request type to POST.
    Generate a temporary endpoint URL from https://webhook.site/ and paste it into the URL field. Use the copy option to avoid errors.
    Note:
    URLs from webhook.site expire after ~1 week, so create a new one as needed.

    Webhook site for testing Ziflow

  4. In the Body field, enter: #{$}# to capture the full payload for the flow. You will get an "Invalid JSON format" error, but it can be ignored. 
    A # on either side of an expression means that it's referencing JSONata instead of regular JSON. 

    Webhook listener

  5. Run the flow. When it executes, the payload will appear in your webhook.site log.
    After the flow is successfully run on the webhook.site, you’ll see this:

    Ziflow proof payload

  6. Delete the listener Zibot to avoid errors when the URL expires in 7 days. 

 

Test payload data with the JSONata Exerciser

Once you’ve captured a payload, you can use the JSONata Exerciser (try.jsonata.org) to experiment with expressions.

  1. Copy the entire payload without the first and last quotation marks.
  2. Paste it into the JSONata Exerciser.
  3. Select the format icon (above the input window) to add line breaks for readability.

    Using JSONata Exerciser for testing Ziflow tokens

  4. Enter a JSONata expression in the top-right field to extract data. It will narrow down the results on the lower-right (don’t put a period after the last piece of the token, or you’ll get an “unexpected" end of expression). 

    Using JSONata Exerciser for testing Ziflow tokens 2

 

Examples

$.proof.versions → lists all proof versions.

$.proof.versions[-1] → the current proof version.

$.proof.versions[-2] → the previous proof version.

  • Type in $.proof.versions to view only the versions.

    Using JSONata Exerciser for testing Ziflow tokens 3
  • Type in $.proof.versions[-1]

    • [-1] gives you the current proof
    • [-2 ]would give you the previous proof

You can test that by seeing what displays below with each value.

Saving work in JSONata Exerciser

 

Save and share your work

To save or share your session in the JSONata Exerciser, select the share icon and bookmark the generated URL.

If you navigate away without saving, your current view will be lost.

Saving work in JSONata exercircer

 

Additional resources

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.