You can use TypeScript to process and manipulate data in Evaluate, Condition, and If blocks in your flows. For example, you might use TypeScript to format a timestamp, check a response for errors, or select an item from a list.
The following recipe describes how to use TypeScript with an Evaluate block to select a random item from a list:
Create a flow module and add an HTTP Request block. For this example, send a GET request to https://openlibrary.org/subjects/love.json?limit=5
.
This gets a list of five book titles.
Connect an Evaluate block to the HTTP Request block’s Success port.
In the Evaluate block, name the variable items
and set it to body.works
.
Enter the following TypeScript in the Evaluate block to select a random title from the response:
items[Math.floor(Math.random() * items.length)].title
Run the flow and click the Evaluate block’s Result output port to see the selected title.
To see this recipe’s completed flow, check out Cookbook: Use TypeScript to select a random item from a list. You can also clone this flow to your workspace to experiment with it.
Last modified: 2025/09/09