---
title: "Use Case 7b: CSAT / NPS after the dialog"
description: "Rating with buttons 1/3/5, INTEGER in Custom Data, chat_closed_alias, audit of connect blocks."
---

# Use Case 7b: Rating after the dialog (CSAT / NPS)

**Level:** basic · **Modules:** Scenario Builder, Custom Data · **Actions:** `custom_modules__set`, optionally `statistic__set`

## Required permissions and access

| What you need | Where in the menu | Why |
|---------------|-------------------|-----|
| **Scenario Builder** | Menu → Scenario Builder | CSAT section, connect with `chat_closed_alias` |
| **Custom Data** | Menu → Custom Data | Model `feedback_scores`, INTEGER field |

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

## Business context

After finishing a dialog with an operator (or self-service), the bot asks to rate service quality and saves the result. Typical requirement: rating **only via buttons**; free text must not enter an INTEGER field.

## Expected result

- Entry into the CSAT section via alias after dialog close (`chat_closed` / `exit_*`).
- Customer chooses a rating with buttons 1 / 3 / 5 (or your set).
- Rating is stored in Custom Data (**INTEGER** field type).
- Free text instead of a button does **not** enter the INTEGER field (edge `error` or validation).
- Optionally: `statistic__set` for platform statistics.

## Flow architecture

```text
[Connect blocks] chat_closed_alias → exit_csat
   → send-message-keyboard (1 / 3 / 5)
        ├─ buttons → custom_modules__set (rate: INTEGER)
        ├─ source-handle → Router / validation (NOT directly into __set)
        └─ error on __set → “Choose a rating with a button”
   → (optional) statistic__set
   → “Thank you for the rating”
```

## Link to other settings

The dialog-close alias (`chat_closed_alias` / `exit_*`) is set in the connect block and must match in **all** connect branches in the scenario. Closing the dialog triggers entry into the CSAT section — this is operator-loop + scenario behavior together.

It is recommended to have connect from [Use Case 3](/en/learn/implementer/training/basic/use-case-03-handoff-to-operator.md) before configuring CSAT.

→ [Connect to operator node](/en/scenariobuilder/explanation/connect-to-operator-node.md)

## Step-by-step implementation

### Step 0. Custom Data — scores model

Custom Data → **New model** `feedback_scores`:

| Field | Type | Alias |
|-------|------|-------|
| Score | **INTEGER** | `rate` |
| Channel | text | `channel` |
| Comment | text | `comment` *(optional)* |

Type **INTEGER** for `rate` is required; free-text into this field will cause a write error.

---

### Step 1. Connect blocks — single exit alias

In **every** `operator_panel__connect_to_operator_with_msg` (and other connects, if any):

| node_params | Value | Why |
|-------------|-------|-----|
| `chat_closed_alias` | `exit_csat` | After dialog close — enter the CSAT section |

**Audit (self-check):** walk all connect blocks in the scenario — alias is the same; no duplicated alias entrypoint in the CSAT section.

---

### Step 2. Entry alias — CSAT section

1. Section with **entry point** `exit_csat`.
2. `send-message-keyboard`: “Rate the service” + buttons `1`, `3`, `5`.

| Parameter | Why |
|-----------|-----|
| `validation.type` | `none` only if source-handle is **disconnected** or protected |
| Edges on each button | → `custom_modules__set` with `feedback_scores:rate` = button value |

**Critical:** the **source-handle** edge (fallback for free text) must **not** go directly into `custom_modules__set`. Options:

- Disconnect source-handle.
- Or → Router / re-ask / validation.

---

### Step 3. Action — `custom_modules__set`

| node_params | Value |
|-------------|-------|
| `module_name` | `feedback_scores` |
| `set_to` | `feedback` |
| constants | `feedback_scores:rate` from the button, `feedback_scores:channel` = `{{channel}}` |

**Edges:** `success` → thank-you · `error` → “Could not save the rating” + check field type.

---

### Step 4 (optional). `statistic__set`

If the instance uses platform CSAT statistics — add the action after a successful CD write per the [actions reference](/en/actionjail/reference/actions-reference.md).

---

### Step 5. Channels without keyboard

Check `supportedMessengers` on the keyboard node: for email / channels without buttons — a separate branch (text rating with validation or skip CSAT).

## Acceptance criteria (self-check Runs)

- [ ] In Runs: after the CSAT question send **text** instead of a button → not success edge on `__set`; no INTEGER type error.
- [ ] Buttons 1/3/5 → record in CD, ID in constants.
- [ ] Connect audit: same `chat_closed_alias` in all blocks.
- [ ] No duplicated alias `exit_csat` in two sections.
- [ ] Edge **error** on `custom_modules__set` is connected.
- [ ] source-handle does **not** go directly into `__set` with an INTEGER field.

## Common mistakes

| Symptom | Cause | What to do |
|---------|-------|------------|
| INTEGER type error | Free-text in `rate` | Protect source-handle, validation |
| CSAT does not start | Different `chat_closed_alias` values | Audit all connect blocks |
| Duplicate entry | Two `exit_csat` in sections | Keep one entrypoint |
| Write OK, statistics empty | No `statistic__set` | Add optionally per docs |

## Related documentation

- [use-custom-modules-set](/en/customdata/how-to/use-custom-modules-set.md)
- [FAQ — CSAT / NPS](/en/learn/implementer/training/reference/faq.md)
- [Use Case 3 — connect](/en/learn/implementer/training/basic/use-case-03-handoff-to-operator.md)
- Next: [Use Case 8 — macro section](/en/learn/implementer/training/basic/use-case-08-macro-section.md)
