The Template block

Template block

Use the Template block to enter large amounts of formatted text or JSON in your flow. You can also embed data blocks in the Template block and reference their data in the text or JSON as variables.

Input

variable - When this port receives data, it assigns the data to a variable. You can then reference the variable in the text box with curly braces like this: {{variable_name}}. You can also embed data blocks here and assign their values to variables.

Variables created in flows aren't available to post-response scripts or other features outside Postman Flows.

Text box - Enter text or JSON here. Select Text or JSON from the dropdown list at the top of the block to specify the input type. Selecting Text sends the input as a string from the Output port. Selecting JSON sends it as formatted JSON, which can be consumed by a Send Request or Select block. With a Select block, you can specify a path to retrieve specific data from the JSON.

Snippets - Select this dropdown list to add pre-defined text and variables to the Template block that you can edit for your use case. Choose from a Markdown document, an HTML email, or an SQL query.

Output

Output - Sends the information entered in the text box. Text input is sent as a string. JSON input is sent as formatted JSON.

Setup

Enter text in the text box and select the dropdown list at the top of the block to specify the input type. The Template block's output port will send text as a string and retain its formatting. It will send JSON as formatted JSON. Reference the Template block's variables with curly braces like this: {{variable_name}}.

To create a variable in the Template block, connect a block's output to the variable input port, or embed a block with Add data blocks Add data blocks. Change an embedded block to a different data block by selecting the embedded block's icon and choosing a block from the dropdown list.

Example

To see the Template block in an example flow, check out Flow Snippets: Template.

The Record and String blocks also enable you to add text to your flows.

You can embed the following blocks in the Template block to include their data as variables in the formatted text or JSON:

Last modified: 2024/10/29