Ziflow Webhook Tokens & Flow Responses

Learn how to build Ziflow tokens based on flow responses.

Updated over a week ago

Summary: In this article, we will guide you on creating & using Ziflow tokens that can be utilized for developing integrations between Ziflow and other platforms. The insights provided here can also aid in troubleshooting any failed Ziflow flows.

Find details on how to:

Building a listener Webhook Zibot

This is how you can figure out your own tokens based on the actual info being set to/from Ziflow when Triggers/Zibots take place.

  • To capture information from a specific flow (e.g., intake form processing or Zibots with desired data output), utilize a Webhook Zibot to add a "listener" functionality.

  • Ensure that the Webhook Zibot is positioned within the flow where the processing will reach. If you encounter difficulties with a particular Zibot still failing (indicated by a red progress bar), place this Zibot before the problematic one to ensure the listener is successfully triggered.

    Failed flow in Ziflow

  • In the example below, I’m going to get the response from the trigger “Decision made on Proof - Accepted

    Decision made on Proof - Accepted / Flow

Create your “listener” Webhook Zibot:

  • Select POST as a request type

  • Please copy a unique URL from https://webhook.site/ and paste it into the URL field. To ensure accuracy, utilize the "copy" option located in the top right corner of the screen. Remember to create a new URL each time as the link expires after approximately one week.

    Webhook site for testing Ziflow

  • Enter "#{$}#” inside the body. This returns everything related to the flow (where the flow successfully makes it to green status).

  • Copy your API key to the Headers section to authorize the request.

Listener Webhook Zibot

After the flow is successfully run on the webhook.site, you’ll see this:

Ziflow proof payload

Pulling proof details using JSONata Exerciser

To experiment with tokens from this listener result, you’ll use a JSONata Exerciser try.jsonata.org:

  • Copy and paste everything MINUS THE FIRST AND LAST QUOTATION MARKS

  • After you paste everything, click on the icon screenshotted below (middle top of the page, just over Invoice), this will add line breaks to what you pasted into the exerciser.

    Using JSONata Exerciser for testing Ziflow tokens
  • Type the token structure into the top right of the screen, and 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). Example output: https://try.jsonata.org/yPRYvCjQG

    Using JSONata Exerciser for testing Ziflow tokens 2

  • Typing in “$.proof.versions” narrowed down to only the versions in the right window.

    Using JSONata Exerciser for testing Ziflow tokens 3

  • Typing in “$.proof.versions[-2]

    • Shows you that the -2 gives you the previous proof

    • [-1} would give you the current proof

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

      Saving work in JSONata Exerciser

Additional information:

  • To save or share your current work in the exerciser, click on the icon below and bookmark the resulting page. Otherwise, if you navigate away from the exerciser, your current view will be lost.

    Saving work in JSONata exercircer

  • When you have # on either side of a token, that means it’s referencing JSONata instead of regular JSON. JSONata gives you a lot more information and functionality because it’s referring to a more robust library.

  • Exerciser for JSON: jsonpath.com

  • Example:

    • JSON to try to get to previous proof: {$.proof.version_previous_id}

    • JSONata to get to previous proof: #{$.proof.versions[-2].version_id}#

Did this answer your question?