---
title: "Use Case 6: Registration + return visit"
description: "registered_users__get on start, registration via __set, greet by name in a new Run."
---

# Use Case 6: Registration + return visit

**Level:** basic · **Modules:** Scenario Builder, Settings → Registered Users · **Actions:** `registered_users__get`, `registered_users__set`

## Required permissions and access

| What you need | Where in the menu | Why |
|---------------|-------------------|-----|
| **Scenario Builder** | Menu → Scenario Builder | Get/set on Start and in the registration branch |
| **Settings → Registered Users** | Settings → Registered Users | Profile fields `first_name`, `phone` |

If a section is missing from the menu — check your account permissions or contact ConnectiveOne support.

## Business context

First visit — registration (name, optionally phone); next visit — greet by name without asking again.

## Key idea: dialog variables vs customer profile

Until Use Case 6 you worked with `{{user_input}}`, buttons, and API — these are **current dialog variables**. Use Case 6 adds **remembering the customer across visits**.

| | **Dialog variables (state)** | **Registered Users (profile)** |
|---|------------------------------|--------------------------------|
| **In plain words** | A “sticker” for one conversation | A customer “card” in the database |
| **How long it lives** | One Run / one dialog | Next visit, new dialog |
| **How to write** | Automatically between nodes (`{{user_name}}`, etc.) | Action **`registered_users__set`** |
| **How to read** | `{{name}}` in later nodes of **this same** Run | **`registered_users__get`** → edge `success` / `error` |

**Mini example**

1. Customer writes “Olena” → “Hi, Olena!” — name from a **dialog variable**, fine **until the end of this Run**.
2. Customer returns tomorrow (or a **new Run** in preview):
   - without **`registered_users__set`** — the bot again “doesn’t know” Olena;
   - with **`__set`** on the first visit + **`__get`** at the start of the second — “Welcome, Olena!”.

**Rule:** everything you collected at registration, save via **`registered_users__set`**. On the next visit, start with **`registered_users__get`**.

## Expected result

- `registered_users__get` at start → success / error.
- error → collect data → `registered_users__set`.
- success → “Welcome, {{registration:first_name}}!”
- **New Run** after registration → `__get` success with the same name.

## Flow architecture

```text
Start → registered_users__get
   ├─ success → “Welcome, {{registration:first_name}}!”
   └─ error → WaitForInput (name, phone) → registered_users__set → “Thank you!”
```

## Step-by-step implementation

### Step 0. Registered Users — model fields

Settings → **Registered Users** → add profile fields (if not yet):

| Field in model | Type | Why |
|----------------|------|-----|
| `first_name` | text | Name for greeting |
| `phone` | phone | Optional for Use Case 5/6 |

Data reaches the action via constants **`registration:first_name`**, **`registration:phone`**, etc.

---

### Step 1. Action on Start — `registered_users__get`

**What it does:** looks up the profile by current dialog `chat_id` + `channel`; if found — loads into `registration:*`.

| node_params | Value | Why |
|-------------|-------|-----|
| `check_by_phone` | `false` | In training — lookup by current chat |

**Edges:**

| Edge | When | Where | Why |
|------|------|-------|-----|
| **`success`** | Profile exists | MessageKeyboard “Welcome, {{registration:first_name}}!” | Return visit |
| **`error`** | New customer | registration branch (step 2) | Expected branch, not a bug |

---

### Step 2. `error` branch — collect data

**WaitForInput — name**

| Parameter | Value |
|-----------|-------|
| messageText | “How should we address you?” |
| outputVariable | `registration:first_name` |

**WaitForInput — phone** *(optional)*

| outputVariable | `registration:phone` |

**Edges:** WaitForInput chain → Action `registered_users__set`.

---

### Step 3. Action — `registered_users__set`

**What it does:** collects all `registration:*` constants and saves the profile in the Registered Users DB.

| node_params | Value | Why |
|-------------|-------|-----|
| `check_by_phone` | `false` | Link to current chat_id |
| `active` | `1` | Active profile |

**Edges:**

| Edge | Where |
|------|-------|
| **success** | MessageKeyboard “Thank you for registering, {{registration:first_name}}!” |
| **error** | “Could not save data” + check model fields |

---

### Step 4. Test “across dialogs”

1. Preview: walk **`error`** → registration → **`success`** on `__set`.
2. **End the Run** → **new Run**.
3. On Start `__get` → must be **`success`**, `{{registration:first_name}}` filled.

## Acceptance criteria (self-check Runs)

- [ ] First Run: `__get` → **error** → registration → `__set` **success**.
- [ ] Second Run (new): `__get` → **success**, name is displayed.
- [ ] Edges **success** and **error** on `__get` are connected.
- [ ] Edge **error** on `__set` is connected with a message.
- [ ] Fields `registration:*` match the model in Settings → Registered Users.

## Common mistakes

| Symptom | Cause | What to do |
|---------|-------|------------|
| Second Run asks for registration again | `__set` did not run or wrong fields | Check the first Run trace |
| `__set` error | Field not in Registered Users model | Add the field in Settings |
| `{{registration:first_name}}` empty | Wrong outputVariable | Format `registration:first_name` |
| Profile “disappears” | Testing in the same Run | End the Run and open a **new** one |

## Related documentation

- [Built-in actions — Registered Users](/en/scenariobuilder/reference/standard-built-in-actions.md)
- [Glossary — registered_users](/en/learn/implementer/training/reference/actions-glossary.md)
- [FAQ — Registered Users](/en/learn/implementer/training/reference/faq.md)
- Next: [Use Case 7 — Custom Data](/en/learn/implementer/training/basic/use-case-07-custom-data.md)
