Skip to main content

Workflow Context: Understand Data Access and Utilization in Torq

Use the workflow context to access execution data, including completed step outputs, trigger event information, and more.

Updated this week

All data in Torq is stored and passed in JSON (JavaScript Object Notation) format. JSON is easy to read, structured, and widely used across REST APIs, making it ideal for automation and data exchange.

In Torq, you use JSONPath to reference specific data points within JSON and pass them between steps.

  • Pass data between steps: Reference values dynamically using JSONPath, even if you don’t know the exact value in advance. Example: $.event.user.macAddress

  • Use in free-text fields: Personalize messages or inputs using template syntax. Example: Hello {{ $.event.user.firstName }}

  • Reuse data easily: Copy JSON paths from one step and use them in subsequent steps to maintain data flow across the workflow.

Understanding JSON structure

JSON is built from key:value pairs, where each key maps to a value.

Example:

{
"party": {
"day": "Saturday",
"time": "2021-11-03",
"address": "123 Party Place",
"food": ["chicken", "beef", "fish", "veggies"],
"decorations": [
{ "style": "balloons", "color": "blue" },
{ "style": "streamers", "color": "red" }
],
"guestsNumber": 25,
"surpriseParty": false
}
}

JSON data types

  • String: Text in quotes
    Example: "day": "Saturday"

  • Number: Numeric value (no quotes)
    Example: "guestsNumber": 25

  • Boolean: true or false
    Example: "surpriseParty": false

  • Array: List of values in []
    Example: "food": ["chicken", "beef"]

  • Object: Collection of key:value pairs in {}
    Example: "party" or objects inside "decorations"

Common JSONPath references

The workflow context is a collection of all the data (in JSON format) available during a workflow execution.

This data is continuously built as the workflow runs and includes:

  • The event that triggered the workflow

  • Outputs from executed steps

  • Data retrieved from third-party integrations

  • Workspace, global, and workflow variables

  • Stored secrets and credentials

Each step can both consume existing data from the context and add new data to it, making it available for subsequent steps.

  • Browse available data: Use the JSONPath autocomplete by typing $ or clicking the + icon in input fields.

  • Navigate the context tree: The structure mirrors JSON, allowing you to explore available keys and values easily.

  • Reference dynamically: Once data is in the context, it can be reused in any subsequent step using its JSONPath.

The following are common JSONPath references you can use to access this context data:

JSONPath

Description

Example

$.event

Access event data that triggered the workflow

{{ $.event.attachments }}

$.integrations

Access configured integrations and their data

{{ $.integrations.wiz_demo }}

$.secrets

Access credentials or stored secrets

{{ $.secrets.api_key }}

$.<step_name>

Access output from a previously executed step

{{ $.extract_urls_from_email.results }}

to build more dynamic automations.

Did this answer your question?