Announcing: The Scout CLI and AI Workflows as CodeLearn More
Back to blocks topics
Blocks

Text Block

Use the Text block in Scout workflows to generate dynamic text based on workflow variables, enabling customized, context-aware outputs for use in later steps.

Text Block:

  • The Text block is a simple but powerful utility for rendering text using Jinja templating within Scout workflows. It's essentially a dynamic text generator that can pull data from anywhere in your workflow and format it exactly how you need it.
  • Key Capabilities:
    • Dynamic text generation using workflow state data
    • Jinja templating support for conditional logic and formatting
    • Variable storage for use in subsequent blocks
    • Text transformation and formatting
  • Think of it as your text formatter and template processor that creates customized content based on your workflow's data.

Use the Text Block for:

  1. Email/Message Templates

Subject: Your Support Request #{{inputs.ticket_id}}

Hi {{inputs.customer_name}},

Your issue has been {{ticket_status.output}}.
{%if ticket_status.output == "resolved"%}
Resolution: {{resolution_details.output}}
{% else %}
Expected resolution time: {{estimated_time.output}} hours
{% endif %}

Team: {{assigned_team.output}}

2. API Request Formatting

Bearer {{_env.API_TOKEN}}
Content-Type: application/json
User-Agent: Scout-Workflow/{{workflow_version.output}}
Request-ID: {{_now | strftime('%Y%m%d') }}-{{ inputs.request_id}}

Block Output

  • The Text block outputs the rendered text string that can be referenced by subsequent blocks:
    • {{your_text_block_id.output}}

Micro-Challenge:

  • Use this playground template to see the Text Block feature in action. This simple workflow collects a few user inputs and automatically fills in an email template.
    • As an added challenge, customize the playground by adding more input variables or modifying the email body. Try using dynamic variables to personalize the text block and experiment with different formatting styles.

Share article: