Skip to main content
All CollectionsHow-tosArticlesBuilding blocks
Building blocks - Event data flow
Building blocks - Event data flow

This article is designed to help you understand how to reference upstream event data throughout your Tines story.

Angela Ruhstorfer avatar
Written by Angela Ruhstorfer
Updated over a week ago

Overview

In this article we'll go over the ways you can reference action event data as it flows through your story. Specifically, we'll take a look at how you can map this output data from one action into subsequent actions. You'll hear this commonly referred to as "upstream events" or "upstream event data."

Tines references

Before getting started, we recommend familiarizing yourself with the surrounding functionality this article covers:

Make it happen

We'll use the following sample of a "Get User Info" action's event data that kicks off a story:

{
"user": "Jane Tino",
"email": "jtino@tines.io",
"usernames": [
{
"value": "jtino",
"is_active": true
},
{
"value": "jane_tino",
"is_active": false
}
]
}

Basic

Throughout these options, let's grab the user's email from the"Get User Info" action's event data. When referencing upstream event data, the JSON path will always start with the referenced action's name in snake case format (i.e. Get User Info → get_user_info).

⚙️ Option One: Type it out

  1. Within your subsequent action, navigate to where you want to reference the upstream data. In our example, this will be within the Payload.

  2. Click + → Value (shortcut: cmd + space | ctrl + space)

  3. Write out the JSON path with your keyboard: get_user_info.body.email

    • As you type out each segment, Tines will try to suggest the next part of the JSON path.

  4. Reference the "Results" on the bottom-right to confirm the data element you are targeting. In our example, this will be: "jtino@tines.io".

⚙️ Option Two: Click through the path

  1. Within your subsequent action, navigate to where you want to reference the upstream data. In our example, this will be within the Payload.

  2. Click + → Value (shortcut: cmd + space | ctrl + space)

  3. Click on the action name you want to get the data path for in the formula widget. For this example, this would be: get_user_info

  4. Each time you click on the element it will auto-fill. This is similar to option one via typing, however, this method tends to be quicker: get_user_info.body.email

    1. Note: You will need to ensure that a . is between each value. You can do so by clicking twice between each.

  5. Reference the "Results" on the bottom-right to confirm the data element you are targeting. In our example, this will be: "jtino@tines.io".

Tines Tip: Instead of clicking, you can also go through the JSON path by pressing enter/return!

⚙️ Option Three: From the Events panel

  1. Locate the upstream event data that you want to map the data from.

  2. Go upstream to the desired action.

  3. Open the Events panel of that action.

  4. Navigate to the part of the data you want by clicking the "..."

  5. While hovering over the object, click on the copy icon that appears on the left-hand side. This will copy the specific JSON path.

  6. Navigate to your subsequent action + where you want to reference the upstream data. In our example, this will be within the Payload.

  7. Execute a paste (cmd + v | ctrl +v).

  8. See your Value pill with the copied JSON path configured.

Tines Tip: When referencing JSON paths from upstream actions, you will need event data to be able to review the output preview in the "Results" on the bottom right of the formula widget. Without it, the "Results" view will show as empty, or sometimes null.

Advanced

⚡️ Arrays - Static referencing

Take a look at the usernames array in our "Get User Info" action. Let's say we want to capture the jane_tino username. We can see that jane_tino is part of the 2nd object in the array. So, to reference this in our subsequent action, we'll capture the following JSON path via one of the basic options above: get_user_info.body.usernames[1].value.

Tines Tip: The reason why the 2nd object in the array is referenced as index 1 in the path is because array indexes start at 0.

However, what happens if that order is swapped, or, we only want to pull active usernames?

🌊 Arrays - Dynamic referencing

If we want to be able to capture a specific set of data, we can integrate Tines functions into our setup. Functions let us use programmatic logic to capture data in a more dynamic way. Let's see how we could filter the array and keep usernames where is_active is true, using our WHERE function.

  1. Within your subsequent action, navigate to where you want to reference the upstream data. In our example, this will be within the Payload.

  2. Click + → Value (shortcut: cmd + space | ctrl + space)

  3. Begin typing out WHERE in the formula widget.

    1. As you start typing this out, Tines will suggest functions that match the letters provided.

  4. Select WHERE.

    1. Our WHERE function accepts the following syntax: WHERE(array, path, [value]). Essentially, WHERE looks at an array and targets a key path using a comparable value.

  5. Since we want to only to see active usernames, format the WHERE function as follows: WHERE(get_user_info.body.usernames, "is_active", TRUE). (Note: TRUE is highlighted + formatted in all-caps due to it being a boolean.)

    1. Make sure to change the data type to Formula mode so WHERE formats the array correctly!

  6. Reference the "Results" on the bottom-right to confirm that the final output will only include usernames where is_active is set to true.

Did this answer your question?