# Export Dialog Texts

Dialog texts are all customer, bot and operator messages of every dialog in the «Dialogs» table for the selected period. The file, in Markdown or JSONL, is handy for an AI agent knowledge base or for manual review. Phone numbers and emails are masked by default.

## When Needed

- You need to fill an AI agent knowledge base with real conversations.
- You need to review dialogs for a period: answer quality, typical questions, bot mistakes.
- You need the whole conversation, not only the table row with dialog data.

## What's Important to Know

- The export works from the **«Dialogs»** card (Statistics → Main statistics) and uses the same filters and period applied on the card.
- The file is prepared in the background. You can close the window — a notification with a **«Download»** button appears when the file is ready.
- The file is personal: only the user who started the export can download it. The link works for a limited time, after that the file is deleted — export again.
- Every export is recorded in the settings audit log (module «Statistics»). Message texts do not enter the log.
- Internal notes and deleted messages are not included. Attachments are marked by file name, for example «[File: contract.pdf]»; the files themselves are not exported.
- Limits per file: up to 20,000 dialogs, 300,000 messages and 200 MB. One dialog is limited to 5,000 messages (the file notes that only the latest ones are shown). If the period is too large, split it into parts, for example a week each.
- One dialog-texts export runs at a time per instance. If you start the same export again while the first one is running, you are returned to the first one.

## Prerequisites

- [x] Your role has the **«Dialog texts export»** right (Settings → Users → Roles → Statistics). Without it the export window offers only the table. See [Configure roles](/en/settings/how-to/configure-roles.md).
- [x] The role has access to the `Statistics` module, «Main statistics» tab.
- [x] You have set the period and filters on the «Dialogs» card.

## Step-by-Step Instructions

1. Open `Apps -> Statistics -> Main statistics` and go to the **«Dialogs»** card.
2. Set the period and filters (channel, operator, skill group, process).
3. Click the table export button — the **«Export table»** window opens.
4. In the **«What to export»** block choose **«Dialog texts»**.

<!-- screenshot: «Export table» window, «What to export» block with «Table» and «Dialog texts» — demo will add -->

5. In the **«Format»** block choose **«Markdown (.md)»** (default) or **«JSONL»**.
6. Change the checkboxes if needed:
   - **«Mask phones and emails»** — on by default; in the file: `+38 067 *** ** 12`, `o***@gmail.com`.
   - **«System messages»** — off by default; adds transfer, topic change, dialog close.
7. Check the summary: «The file will contain N dialogs for the period. Filters: …».
8. Click **«Export»**. A bar «Preparing the file… X of N dialogs» appears.

<!-- screenshot: progress bar «Preparing the file… X of N dialogs» with the hint that the window can be closed — demo will add -->

9. Close the window or wait. When the file is ready, the notification «Dialog texts file is ready» with a **«Download»** button appears.

<!-- screenshot: notification «Dialog texts file is ready» with the «Download» button — demo will add -->

10. Click **«Download»** and save the file.

<!-- video: dialog texts export, from choosing «Dialog texts» to the opened file with masking — demo will add -->

## What Is in the File

The file contains dialogs closed in the selected period. Dialogs go in ascending number order, messages in sending order. Time is in the statistics time zone. All messages of a dialog are taken, regardless of the period.

The file is named `dialogs-YYYY-MM.md` (or `.jsonl`) when a whole calendar month is selected, otherwise `dialogs-<from>_<to>.md`. Dialogs without any message are left out of the file.

**Markdown (.md).** File header: period, time zone, filters, export date, number of dialogs, whether masking is on. Then sections «## Dialog {number} · {closed} · {channel} · {topic} · CSAT {score or —}» and lines like «**Client** (dd.mm hh:mm): text». The author is «Client», «Bot» or «Operator» (first and last name); «System» appears only with the «System messages» checkbox.

**JSONL.** One JSON line per message with fields `dialog_id`, `dialog_closed_at`, `channel`, `subject`, `csat`, `message_id`, `sent_at`, `author_type` (`client`, `bot`, `operator`, `system`), `author_name` (operator only), `text`, `attachments`.

Message text is one line without HTML, up to 20,000 characters. An empty message without attachments is «[no text]».

**Masking.** Phone: the first 5 and the last 2 digits are shown, the rest are asterisks. Email: the first letter, `***` and the domain. Dialog numbers, links, amounts and dates are not changed. Masking covers only phones and emails. A client name or other personal data that a person typed in the message text is not masked, and the operator name is not masked either, so review the file before uploading it to an AI tool.

## What Happens Next

The file is kept in private storage. The link is available only to you until the file is deleted. If you need the file again, start the export again.

## How to Verify Success

- The notification shows the number of dialogs, period and format you expected.
- The number of sections in the file (md) matches the summary in the window; a dialog closed several times in the period goes once.
- Phones and emails in the file are masked (if you did not clear the checkbox).

## If Something Went Wrong

| What is shown | What to do |
| :--- | :--- |
| «The period is too large — split it into parts…» | Shorten the period (for example, to a week) or add filters and export in parts |
| «There are no dialogs for these filters.» | Change the period or filters |
| «You have no right to export dialog texts…» | Ask an administrator to add the right to your role |
| «File storage is not ready for dialog texts. Contact support.» | Contact support |
| «The export was interrupted. Start it again.» | Start the export again; if it repeats, contact support |
| «Too many exports are running. Try again in a moment.» | Wait for the current export to finish and retry |

## Related Materials

- [How to Export Statistics Data](/en/statistics/how-to/export-statistics-data.md)
- [Export a Report](/en/statistics/how-to/export-report.md)
- [Configure Roles and Permissions](/en/settings/how-to/configure-roles.md)
