You can use JSONata expressions to pass values from earlier Ziflow events and Zibots in your automation flow into other Zibots (such as Webhook Zibots). You can also use them in customized email templates.
When you create integrations with Ziflow, you’ll often need to pass information in JSON format. JSON is a way to structure data so that apps can read it.
JSONata is a query language for JSON. JSONata expressions are supported in all open text fields in webhook flow Zibots and customized email template fields.
JSONata in Webhook Zibots
In automation flows, you can reference data from:
- The starting event (e.g., proof created, decision made, comment added, an intake form)
- Previous Zibots in the same flow
Use #{ ... }# to insert a JSONata expression
Wrap a reference in #{ }# so Ziflow knows it's JSONata and that it should replace the expression with the actual value when the flow runs.
When to use it:
As a placeholder to pass dynamic data from Ziflow into another system (e.g., proof IDs, names, statuses).
Examples
Placeholder for the full proof object:
#{$.proof}#
Placeholder for the proof ID (e.g., "p123"):
#{$.proof.id}#
In a payload:
{
"proofId": "#{$.proof.id}#",
"proofName": "#{$.proof.name}#"
}
After, the JSONata expression is replaced with the real data:
{
"proofId": "p123",
"proofName": "Ad Campaign"
}
Use $ to reference all the data
The $ symbol represents everything in the flow. Think of it as the “starting point” for looking up information. Start with $ when you want access to the full dataset.
When to use it:
As a starting point before drilling down to specific fields.
Example
#{$}# Refers to all the data in this flow
Use .[object name] to target one item
Add a dot (.) and a name to point to a specific item inside the data.
When to use it:
To get a single property, like a proof name or ID.
Example
#{$.proof.name}# Gets the "name" field inside the "proof" object
Reference objects
To insert a value, type its JSONata expression, starting with #{$. followed by the object name.
Available objects depend on the event type:
| Object | Expression | When available |
| Proof | #{$.proof}# | All proof-related events |
| Stage | #{$.stage}# | Stage-related events |
| Reviewer | #{$.reviewer}# | Reviewer-related events |
| Intake form | #{$.form}# | Intake form submission events |
| Comment | #{$.comment}# | Comment-related events |
| Zibot | #{$.zibot[#].data}# | From earlier Zibots in the flow, where # is the zibot place in the flow starting at 0 - see note below |
Note: Zibot numbering starts at 0. To view the numbering, hover over the Zibot in the Flow pane.
Event-specific objects
The value you can pull into your Zibots using JSONata depends on what event triggered your Ziflow flow. For example:
| Event | Available objects |
| New proof/version | #{$.proof...}# |
| Decision on proof | #{$.proof...}# |
| Decision on stage | #{$.proof...}, {$.stage...}# |
| Decision on reviewer | #{ $.proof...}, {$.reviewer...}# |
| Comment added | #{$.proof...}, {$.comment...}# |
To get a specific value in the JSON return object, use a JSONata expression that points to that value in the JSON structure. JSONata in Ziflow follows standard syntax, so any valid JSONata expression will work.
- Go to the Ziflow API reference page to see the JSON object returned for the relevant proof event.
- For external applications, refer to their REST API documentation to understand their JSON response structure.
Examples:
| Goal | JSONata expression |
| Get the folder name of the proof that triggered a flow | #{$.proof.folder.name}# |
| Get the proof creator’s first and last name | #{$.proof.created_by.first_name & " " & $.proof.owner.last_name}# |
| Get the first stage name in the proof | #{$.proof.stages[0].name}# |
JSONata in email templates
In customized email templates, you can insert predefined tokens or use JSONata expressions to dynamically include proof data in the email subject and content. See Customize email templates.
JSONata expressions can be used similarly to how they are used in Zibots. The one difference is that for email, the expression requires event to be part of the path, for example,#{$.event.proofs.count}# See Useful Ziflow webhooks and JSONata examples.
Comments
0 comments
Please sign in to leave a comment.