Use Case 6: Registration + return visit
Level: basic · Modules: Scenario Builder, Settings → Registered Users · Actions: registered_users__get, registered_users__check_phone, 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 |
Preview vs channel. Each Preview Run is a new customer (new chat_id). The profile is looked up by chat_id + channel, so a second Preview Run will not see the registration from the first. Verify the return visit (greet by name) in a real channel (Telegram / widget), where chat_id stays stable across dialogs.
Mini example
- Customer writes “Olena” → “Hi, Olena!” — name from a dialog variable, fine until the end of this Run.
- Customer returns tomorrow in the same channel (same Telegram / widget):
- without
registered_users__set— the bot again “doesn’t know” Olena; - with
__seton the first visit +__getat the start of the second — “Welcome, Olena!”.
- without
Rule: everything you collected at registration, save via registered_users__set. On the next visit, start with registered_users__get.
Expected result
registered_users__getat start → success / error.- error → collect data →
registered_users__set. - success → “Welcome,
{{client.first_name}}!” - Return visit in a channel after registration →
__getsuccess with the same name.
Flow architecture
Start → registered_users__get
├─ success → “Welcome, {{client.first_name}}!”
└─ error → WaitForInput (name, phone) → registered_users__check_phone → registered_users__set → “Thank you!”
If you collect phone as text: run registered_users__check_phone before registered_users__set. __set does not normalize 050… → 380… — without check_phone the number is saved as entered.
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 for write (__set) reaches the action via constants reg_first_name, registration:first_name, reg_phone / registration:phone, etc. For typed phone, use outputVariable: reg_phone, then registered_users__check_phone.
How to read after __get (do not confuse with write): the action sets two objects — client (standard profile columns: first_name, phone, …) and registration (custom fields from the data column). In messages use a dot path: {{client.first_name}}. The placeholder {{registration:first_name}} (with a colon) is not filled after __get — that is a different mechanism (flat key), and __get does not create it.
On the registration branch (before __get), use the input variable from this same dialog ({{reg_first_name}}), because the profile has not been read yet.
Step 1. Action on Start — registered_users__get
What it does: looks up the profile by current dialog chat_id + channel; if found — loads the client constant (profile row) and registration (the data object).
| node_params | Value | Why |
|---|---|---|
check_by_phone |
false |
In training — lookup by current chat |
Edges:
| Edge | When | Where | Why |
|---|---|---|---|
success |
Profile exists | MessageKeyboard “Welcome, {{client.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 | reg_first_name |
WaitForInput — phone (optional)
| Parameter | Value |
|---|---|
| messageText | “Your phone number” |
| outputVariable | reg_phone |
Action — registered_users__check_phone (if phone was collected)
| Edge | When | Where |
|---|---|---|
| success | Phone normalized in reg_phone (380…) |
registered_users__set |
| error | Invalid format | message “Check your number” |
Edges: WaitForInput chain → registered_users__check_phone → registered_users__set.
Step 3. Action — registered_users__set
What it does: collects profile constants (registration:*, reg_*) and saves the record in the Registered Users DB. Does not normalize phone — expects prepared reg_phone after check_phone.
| 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, {{reg_first_name}}!” |
There is no error branch for __set in the typical scenario (the action returns success after save). Handle invalid phone on registered_users__check_phone.
On this branch the name still comes from the dialog variable (reg_first_name). After __get on the next visit, use {{client.first_name}}.
Step 4. Test: Preview and return visit in a channel
A. Preview (registration branch)
- Preview: walk
error→ registration →successon__set. - (Optional) Settings → Registered Users — a record with the name exists:
__setworked. - New Preview Run: on Start
__getiserroragain — expected. Preview creates a new customer each time; the profile is not picked up across Runs.
B. Channel (return-visit criterion)
- The same user in Telegram or a widget: first dialog — registration (
__setsuccess). - Second dialog from the same user: on Start
__get→success,{{client.first_name}}filled.
Without step B you only proved that the profile was saved, not recognition on return.
Acceptance criteria (self-check)
Common mistakes
| Symptom | Cause | What to do |
|---|---|---|
| Second dialog in the channel asks for registration again | __set did not run or wrong fields |
Check the first dialog / Run trace |
__set did not save profile |
Field not in Registered Users model | Add the field in Settings |
Phone 066… in database |
__set without check_phone |
Add registered_users__check_phone before __set |
After __get, “Welcome, !” / empty name |
Message uses {{registration:first_name}} (colon) instead of {{client.first_name}} |
After __get use {{client.first_name}}; a colon looks up a flat key that __get does not set |
| Second Preview Run asks for registration again | Preview = new chat_id every time |
Expected; verify the return visit in a channel |