Skip to content

Customer Database Export with /export Command

The /export command exports information about Hotline dialogs as a tabular report containing users and group chats. You can export all active dialogs, select dialogs by one or more labels, exclude specific labels, or retrieve information about deleted topics. You can also enrich the dialog list with current Telegram data such as language, username, name, and phone number.

On this page, a label means a Hotline mark created and assigned with the /mark command. The command syntax and CSV field therefore use the term mark, even though the feature is described as a label in English.

How It Works

The command works only in the General topic of the backend group. After it starts, a message appears in General, and the operator receives a report generation notification in a private chat with the setup bot.

The completed CSV file is sent to the operator in the private chat with the setup bot. Only a short summary is posted in General: export mode, row count, and error count. If the setup bot cannot send a private message to the operator, the export does not start.

Main Features

  • Export all active dialogs
  • Select dialogs by one or more labels
  • Exclude dialogs with specified labels
  • Export information about deleted topics
  • Add current Telegram data: username, name, language, and phone number
  • Select a connection when several connections use the same backend group
  • Stop an export in progress

Export Format

For active dialogs, the CSV file contains the following fields:

Field Description
chat_id Telegram chat or user identifier; topics use the chat_id(thread_id) format
last_date Date of last message in topic
status Current dialog status (user_answered, support_answered, closed)
title Topic name
frontend_type Topic type (private, group, channel, etc.)
topic_link Link to topic in backend group
marks Hotline marks assigned with the /mark command (called labels on this page)
ignore_chat Indicates whether the chat is included in the IGNORE_CHATS parameter

For deleted dialogs, the available fields are chat_id, last_date, status, title, and frontend_type.

The with option adds selected username, name, lang, and phone fields. An error column is added with them and contains an error message if Hotline could not retrieve current Telegram data for a particular chat.

CSV Format

The CSV file can be opened in Excel or Google Sheets, or imported into other CRM systems for further processing.

The /export command sends the report to the operator in CSV format. With API access, the same completed report can be retrieved as TSV through the /api/v2/export/{export_id}/report?format=tsv endpoint.

Calling the Command

Help

/export
/export help

Both commands display help in English.

All Active Dialogs

/export all

Exports all active dialogs for the current connection.

Dialogs with Labels

/export mark deal
/export mark vip,deal

When several labels are specified, the report includes dialogs with at least one of them. For example, /export mark vip,deal selects dialogs labeled vip or deal.

If any specified label does not exist, the export does not start. Separate label names with commas.

Excluding Labels

/export all exclude spam,test
/export mark vip,deal exclude blocked

The exclude option removes dialogs that have at least one of the labels listed after it. It can be used with the all and mark modes.

Deleted Dialogs

/export deleted

Exports dialog information from the deleted topics archive. Labels and exclude are not used in this mode.

Export data is taken from the Hotline database. To check whether topics still exist and move missing ones to the archive beforehand, run /sync all deleted in the General topic. Checking many topics can take a long time, so for a large dialog database it is better to first try sync with the dry option and the desired number of dialogs, for example /sync 10 dry.

Additional Data

/export all with username,name
/export mark vip,deal with lang,phone
/export deleted with data

After with, specify any of the username, name, lang, and phone fields separated by commas. The data value is shorthand for retrieving all four fields.

Current data is retrieved through Telegram, which increases report generation time. When connected accounts or bots are affected by Telegram-side restrictions, individual rows may contain a value in the error column instead of the requested data.

Selecting a Connection

/export all instance INSTANCE_ID
/export mark vip,deal instance INSTANCE_ID with data

The instance INSTANCE_ID option runs the export only for the specified connection. It is useful when several bots or accounts are connected to the same backend group.

Stopping an Export

/export stop

Stops the active export for the connection. No partial report is generated when an export is stopped. Only one export can run for a connection at a time.

Important Notes

Access rights

Access to the command is controlled by the EXTENSIONS_ALLOWED parameter. If the list is empty or absent, the command is available to all backend group operators. A non-empty list allows only the specified operators to use it.

Confidentiality

The CSV file may contain chat identifiers, service segmentation attributes, names, and phone numbers. Follow confidentiality rules when working with exported data. It is recommended to download export files immediately and delete them from the chat after completing work.

Regular export

Make regular database exports to create backups.

Size Limit

A single report can contain up to 100,000 rows. If the result exceeds this limit, the export ends with an error.