---
title: "Use Case 8: Macro section"
description: "Section with the “macro” flag, order_id parameter, check in Runs; OP Process macro — optional E2E."
---

# Use Case 8: Macro section in the scenario

**Level:** basic · **Modules:** Scenario Builder · **Settings → Operator Panel → Process macro** *(optional E2E)*

## Required permissions and access

| What you need | Where in the menu | Why |
|---------------|-------------------|-----|
| **Scenario Builder** | Menu → Scenario Builder | Macro section, logic inside |
| **Settings → Operator Panel → Process macro** | Settings → Operator Panel → Process macro | Optional: button in Operator Line (E2E) |

If the **Process macro** section is missing from the menu — you can complete core Use Case 8 with a **Runs** check only; E2E via Operator Line is optional.

## Business context

An operator in a dialog runs a short scenario (order status check, lookup) — the logic lives in a **Scenario Builder section** with the “macro” flag, not in a separate bot.

## Expected result

- A separate **section** with the “Used as macro” flag.
- Macro input parameter (e.g. `order_id`).
- Logic verified in **Runs** (macro section trace).
- *(Optional E2E)* Process macro in Settings → “Run macro” button in Operator Line.

## Flow architecture

```text
[Macro section] Start (macro) → WaitForInput / macro form (order_id)
   → action_send_request or MessageKeyboard “Status OK for {{order_id}}”
   → End / return to operator dialog
```

## Link to other settings

Settings → Operator Panel → **Process macro** → select the bot with the macro section. Needed only for optional E2E verification in Operator Line.

→ [Implementer overview — macros](/en/learn/implementer/implementer-overview.md)

## Step-by-step implementation

### Step 1. Scenario section for macro

Scenario Builder → **new section** (e.g. `Macro Check Status`):

| Section setting | Value | Why |
|-----------------|-------|-----|
| **Used as macro** | enabled | Section available from OP, not as a normal customer entry |
| Macro variable | `order_id` (text, required) | Operator enters on launch → `{{order_id}}` in nodes |

---

### Step 2. Logic inside the section (simplified)

**Option A — no API (minimum):**

| Node | Parameters |
|------|------------|
| MessageKeyboard *(or macro result node)* | “Checked order **{{order_id}}**: status OK” |

**Option B — mock API (like Use Case 4):**

| Action `action_send_request` | `url` with `{{order_id}}` or a fixed mock |
| Edges | `ok` → text with `{{crm_data…}}` · `not_ok` → “CRM unavailable” |

The macro must **not** call `operator_panel__connect` — it is already inside the operator dialog.

---

### Step 3. Wire-up in Operator Panel *(optional — E2E)*

Settings → Operator Panel → **Process macro** → select the bot with the macro section.

**Acceptance (core):** Runs trace of the macro section with a test `order_id`.

**Acceptance (optional E2E):** “Run macro” button in an Operator Line dialog.

---

### Step 4. Test *(optional E2E)*

1. Open a customer dialog (convenient after [Use Case 3](/en/learn/implementer/training/basic/use-case-03-handoff-to-operator.md)).
2. **“Run macro”** button → select macro → enter `order_id`.
3. Result in the dialog; Runs — macro section trace.

**Core test without OP:** Scenario Builder → Runs → run the macro section with a test `order_id` in the trace.

## Acceptance criteria (self-check Runs)

- [ ] Section is marked “Used as macro.”
- [ ] Parameter `order_id` is available in nodes as `{{order_id}}`.
- [ ] Runs trace shows macro section execution with the test value.
- [ ] The section has **no** `operator_panel__connect`.
- [ ] (Optional E2E) Macro appears in Operator Line after Process macro is configured.

## Common mistakes

| Symptom | Cause | What to do |
|---------|-------|------------|
| Macro not in OP | Process macro not configured | Settings → OP → Process macro |
| `{{order_id}}` empty | Parameter not declared in the section | Add the macro variable in section settings |
| Connect inside the macro | Extra node | Remove connect — the macro is already in the dialog |
| Empty trace | Not launched via macro Runs | Run the section trace with the parameter |

## Related documentation

- [Implementer overview](/en/learn/implementer/implementer-overview.md)
- [Use Case 4 — mock API](/en/learn/implementer/training/basic/use-case-04-api-integration.md)
- [FAQ — Macros](/en/learn/implementer/training/reference/faq.md)
- Next: [Use Case 9 — scenario audit](/en/learn/implementer/training/basic/use-case-09-scenario-audit.md)
