Use TypeScript in Postman Flows

You can use TypeScript to enhance logic and functionality in the logic blocks of your Postman Flows. For example, with TypeScript you can write expressions that evaluate data informing your Flow's decisions, and functions that process data within your Flow.

TypeScript in an Evaluate block

TypeScript compared to FQL

The logic blocks in Postman Flows (If and Evaluate) support both Flows Query Language (FQL) and TypeScript. While FQL is designed for querying and transforming data, TypeScript offers the robustness and flexibility of a full programming language within your Postman Flows. This makes TypeScript more suitable for complex logic and large-scale projects. Also, if you are familiar with both the JavaScript and TypeScript ecosystems, you may prefer using TypeScript over FQL.

Restrictions and notes

Scripts written with TypeScript in Postman Flows have the following restrictions:

  • Scripts can't import or require libraries.
  • Scripts don't have file system access.
  • Scripts can't make API calls (for example, fetch isn't available).
  • The top level code must be an expression.

TypeScript in Postman Flows provides a range of cryptographic capabilities including the Web Crypto API, SHA-256 hashing, AES encryption, and secure random number generation, among others.

You can use TypeScript to send console logs to the Postman Console using the following methods:

  • console.log
  • console.error
  • console.warn
  • console.info

Use TypeScript in a Postman Flows decision block

To use TypeScript in an Evaluate or If block, select TypeScript from the dropdown list and enter your code in the block. Evaluate and If blocks use FQL by default.

Select TypeScript

Last modified: 2024/04/29