Variables and Passing Data Between Blocks
Table of contents:
- What are variables in a workflow
- Reading data from a previous step
- Expressions and data transformations
- Debugging — previewing variable values
Every workflow block can use data produced by previous blocks. This data is available as variables — you can insert them into task titles, comments, AI prompts, or HTTP request fields.
What are variables in a workflow
A variable is a reference to a specific data field that was retrieved or produced by an earlier block in the same workflow.
Variable format:
{block_number.field_name}For example, if block 1 retrieved campaign data from Google Ads and returned a campaign_name field, you can use the following in the next block:
{1.campaign_name}Sembot will replace this expression with the actual value when the workflow runs.
Practical example:
A Sembot Task block with the title:
Review campaign {1.campaign_name} — budget: {1.budget}After execution becomes:
Review campaign Summer Sale — budget: 5000Global variables:
A workflow can have defined global variables — values shared across the entire workflow (e.g., an API address, an alert threshold). They are accessible in the toolbar under the "Global Variables" button. You reference them using:
globals.variable_name📸 [SCREEN: block properties panel with a text field containing a variable — visible hint with a list of available fields from previous blocks]
Reading data from a previous step
When you configure a block, Sembot automatically suggests what data is available from earlier blocks — you don't need to guess or remember field names.
How it works in the editor:
In any text field (title, description, comment, URL, AI prompt) you can click the "Open expression selector" icon — a list of available data from previous blocks will appear, grouped by the block that produced them.
Available fields depend on which block produced them:
| Source block | Example available fields |
|---|---|
| Google Ads Getter — campaigns | campaign_name, budget, status, metrics.spend, metrics.conversions |
| Google Analytics 4 Getter | sessions, conversions, source, medium |
| Webhook trigger | webhook.payload.feed_job_id, webhook.payload.status |
| Sembot Task | task_id, task_title |
| HTTP Request | Fields from the API response (if parsing is enabled) |
| Loop | iterator_current_index, iterator_total_count + fields of the current item |
Nested fields:
If data has a nested structure (e.g., metrics inside a campaign), you access them using dot notation:
{1.metrics.spend} → campaign spend
{1.metrics.conversions} → campaign conversionsFull scenario example:
Block 1 — Fetch Google Ads campaigns
Returns: campaign_name, budget, status, metrics.spend
Block 2 — If Condition
Checks: {1.metrics.spend} > {1.budget} * 0.9
Block 3 — Sembot Task
Title: "Budget nearly exhausted: {1.campaign_name}"
Description: "Spent {1.metrics.spend} of {1.budget} budget."📸 [SCREEN: expanded variable suggestion list in the task title field — grouped by blocks: "Block 1: Fetch campaigns" with a list of fields campaign_name, budget, status...]
Expressions and data transformations
Variables can not only be inserted but also transformed — formatting dates, performing calculations, or creating time ranges.
Date and time functions:
Useful when you want to limit data to a specific period, e.g., "last 30 days":
{NOW()} → current date and time
{NOW().subtractNumberOfDays(30)} → date 30 days ago
{NOW().addNumberOfDays(7)} → date 7 days from now
{NOW().formatDateTime('Y-m-d')} → formatted date, e.g. 2026-05-19
{NOW().subtractNumberOfDays(30).formatDateTime('Y-m-d')} → chaining functionsUsage example — Google Ads data getter with a dynamic date range:
Date from: {NOW().subtractNumberOfDays(7).formatDateTime('Y-m-d')}
Date to: {NOW().formatDateTime('Y-m-d')}Result: the workflow always fetches data from the last 7 days, regardless of when it runs.
Mathematical calculations:
{1.metrics.spend} + 100
{1.conversions} * 1.5
{1.clicks} / {1.impressions}
{1.revenue} - {1.cost}Useful, for example, in an If block to compare spend against a threshold or calculate a conversion rate.
Combining values in text:
Variables can be freely combined with static text:
Campaign {1.campaign_name} spent {1.metrics.spend}
of the {1.budget} budget between
{NOW().subtractNumberOfDays(7).formatDateTime('d.m')}–{NOW().formatDateTime('d.m.Y')}Result:
Campaign Summer Sale spent 4200 of the 5000 budget between 12.05–19.05.2026📸 [SCREEN: AI Agent block prompt field with date expressions and variables from previous blocks]
Debugging — previewing variable values
When you run the workflow using the "Run once" button, the Workflow Inspector opens on the right side, showing exactly what data was processed for each block.
What you see for each block:
| Information | What it means |
|---|---|
| Status | Green (success) / Red (error) / Gray (skipped) |
| Execution time | How many milliseconds this block took |
| Input data | Parameters passed to the block — variable values from previous blocks already substituted |
| Output data | Actual data returned by the block — e.g. {"campaign_name": "Summer Sale", "budget": 5000} |
| Execution details | Technical details of the block's execution |
| Error | Error message if the block failed |
How to use the Workflow Inspector to verify variables:
- Click "Run once" in the top bar of the editor.
- Click the block you are interested in.
- In the Output data section, you will see the actual values that block returned — these are exactly the values that subsequent blocks will use.
- If a variable in the next block is not working as expected, check whether the field name in Output data matches what you entered in the expression.
Common causes of variable issues:
- Typo in the field name —
{campain_name}instead of{campaign_name}→ variable is empty - Wrong block number —
{2.campaign_name}when data is in block 1 → no value - Nested field without dot notation —
{metricsSpend}instead of{metrics.spend}→ no value - Block skipped by a condition — data from a block that was not executed is unavailable
📸 [SCREEN: Workflow Inspector on the right side — expanded "Fetch campaigns" block with "Input data" and "Output data" sections containing actual JSON values]