# imopenlines.dialog.get

URL: https://chugunov.pro/api-bitrix24/imopenlines/openlines/sessions/imopenlines-dialog-get/
Проверено на Битрикс24 REST API, обновлено 11.09.2026 (ревизия источника fb39d6c).
Источник: официальная документация Битрикс24 (bitrix-tools/b24-rest-docs, лицензия MIT, © Bitrix). Справочник независимый, официальной документацией не является.

Получить информацию о диалоге оператора
Scope: `imopenlines`
Кто может выполнять метод: любой пользователь с правом на доступ к диалогу

## Описание

Метод `imopenlines.dialog.get` возвращает данные чата открытой линии. Достаточно передать один из параметров.

## Параметры

- `CHAT_ID` `integer` — необязательный. Идентификатор чата открытой линии.
  Идентификатор можно получить методом [imopenlines.session.open](https://chugunov.pro/api-bitrix24/imopenlines/openlines/sessions/imopenlines-session-open/) или [imopenlines.session.history.get](https://chugunov.pro/api-bitrix24/imopenlines/openlines/sessions/imopenlines-session-history-get/)
- `DIALOG_ID` `string` — необязательный. Идентификатор диалога в формате `chat<ID>`, где `<ID>` — идентификатор чата открытой линии
- `SESSION_ID` `integer` — необязательный. Идентификатор сессии. 
  Идентификатор можно получить методом [imopenlines.session.history.get](https://chugunov.pro/api-bitrix24/imopenlines/openlines/sessions/imopenlines-session-history-get/) в поле `sessionId`
- `USER_CODE` `string` — необязательный. Строковый код пользователя для канала внешней системы. 
  Формат кода: ```<connector>|<LINE_ID>|<CONNECTOR_CHAT_ID>|<CONNECTOR_USER_ID>```, где:
  - `<connector>` — идентификатор коннектора: `livechat`, `telegram` и другие
  - `<LINE_ID>` — идентификатор открытой линии
  - `<CONNECTOR_CHAT_ID>` — идентификатор чата в канале
  - `<CONNECTOR_USER_ID>` — идентификатор пользователя в канале
  Значение можно получить методом [imopenlines.session.history.get](https://chugunov.pro/api-bitrix24/imopenlines/openlines/sessions/imopenlines-session-history-get/) из `result.chat.<chatId>.entityId`

## Ответ

HTTP-статус: 200

```json
{
    "result": {
        "id": 1777,
        "parent_chat_id": 0,
        "parent_message_id": 0,
        "name": "Салатовый гость №17 - Документация Битрикс24",
        "description": null,
        "owner": 27,
        "extranet": false,
        "avatar": "",
        "color": "#58cc47",
        "type": "lines",
        "counter": 0,
        "user_counter": 2,
        "message_count": 104,
        "unread_id": 0,
        "restrictions": {
            "avatar": true,
            "rename": true,
            "extend": true,
            "call": true,
            "mute": true,
            "leave": true,
            "leave_owner": true,
            "send": true,
            "user_list": true
        },
        "last_message_id": 86313,
        "last_id": 86313,
        "marked_id": 0,
        "disk_folder_id": 0,
        "entity_type": "LINES",
        "entity_id": "livechat|22|1775|599",
        "entity_data_1": "Y|LEAD|1209|N|N|343|1773682918|0|0|0",
        "entity_data_2": "LEAD|1209|COMPANY|0|CONTACT|0|DEAL|0",
        "entity_data_3": "N",
        "mute_list": [],
        "date_create": "2026-03-13T16:50:15+03:00",
        "message_type": "L",
        "public": "",
        "role": "owner",
        "entity_link": {
            "type": "LINES",
            "url": "",
            "id": "livechat|22|1775|599"
        },
        "text_field_enabled": true,
        "background_id": null,
        "permissions": {
            "manage_users_add": "member",
            "manage_users_delete": "manager",
            "manage_ui": "member",
            "manage_settings": "owner",
            "manage_messages": "member",
            "can_post": "member"
        },
        "is_new": false,
        "readed_list": [
            {
                "user_id": 599,
                "user_name": "Гость",
                "message_id": 86101,
                "date": null
            }
        ],
        "manager_list": [27],
        "last_message_views": {
            "message_id": 86313,
            "first_viewers": [
                {
                    "user_id": 27,
                    "user_name": "Светлана Иванова",
                    "date": "2026-03-16T20:50:37+03:00"
                }
            ],
            "count_of_viewers": 0
        },
        "dialog_id": "chat1777"
    },
    "time": {
        "start": 1773683678,
        "finish": 1773683678.423382,
        "duration": 0.423382043838501,
        "processing": 0,
        "date_start": "2026-03-16T20:54:38+03:00",
        "date_finish": "2026-03-16T20:54:38+03:00",
        "operating_reset_at": 1773684278,
        "operating": 0
    }
}
```

### Возвращаемые данные

- `result` `object`. Объект данных чата [(подробное описание)](#result)
- `time` `time`. Информация о времени выполнения запроса

## Ошибки

HTTP-статус: 400

```json
{
    "error": "ACCESS_ERROR",
    "error_description": "You do not have access to the specified dialog"
}
```

- `400` — `IM_NOT_INSTALLED`. Messenger is not installed.
- `400` — `ACCESS_ERROR`. You do not have access to the specified dialog

## Примеры запроса

### cURL (Webhook)

```bash
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"USER_CODE":"livechat|1|1373|211"}' \
  https://your-domain.bitrix24.ru/rest/1/webhook_key/imopenlines.dialog.get.json
```

### cURL (OAuth)

```bash
curl -X POST \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"USER_CODE":"livechat|1|1373|211","auth":"<access_token>"}' \
  https://your-domain.bitrix24.ru/rest/imopenlines.dialog.get.json
```

### JS (TS)

```ts
// This snippet is an ES module: top-level await requires type="module" or a bundler.
// $b24 is an already-initialized SDK instance (see the SDK "Get started" guide).
import { Text } from '@bitrix24/b24jssdk'
import type { B24Frame, ISODate } from '@bitrix24/b24jssdk'

declare const $b24: B24Frame

// Shape of the payload returned in result (match the "response handling" section of the page)
type DialogGetResult = {
  id: number
  parent_chat_id: number
  parent_message_id: number
  name: string
  description: string | null
  owner: number
  extranet: boolean
  avatar: string
  color: string
  type: string
  counter: number
  user_counter: number
  message_count: number
  unread_id: number
  restrictions: Record<string, boolean>
  last_message_id: number
  last_id: number
  marked_id: number
  disk_folder_id: number
  entity_type: string
  entity_id: string
  entity_data_1: string
  entity_data_2: string
  entity_data_3: string
  mute_list: number[]
  date_create: ISODate
  message_type: string
  public: string
  role: string
  entity_link: { type: string; url: string; id: string }
  text_field_enabled: boolean
  background_id: number | null
  permissions: Record<string, string>
  is_new: boolean
  readed_list: Array<{ user_id: number; user_name: string; message_id: number; date: ISODate | null }>
  manager_list: number[]
  last_message_views: {
    message_id: number
    first_viewers: Array<{ user_id: number; user_name: string; date: ISODate }>
    count_of_viewers: number
  }
  dialog_id: string
}

try {
  const response = await $b24.actions.v2.call.make<DialogGetResult>({
    method: 'imopenlines.dialog.get',
    params: {
      USER_CODE: 'livechat|1|1373|211',
    },
    requestId: Text.getUuidRfc4122()
  })

  // The payload is available only on a successful response
  if (!response.isSuccess) {
    console.error(response.getErrorMessages().join('; '))
  } else {
    const result = response.getData()!.result
    console.info(result.id, result.name, result.dialog_id)
  }
} catch (error) {
  // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
  console.error(error)
}
```

### JS (UMD)

```html
<!-- Load the SDK (UMD build); it is exposed as the global B24Js -->
<script src="https://unpkg.com/@bitrix24/b24jssdk@1/dist/umd/index.min.js"></script>
<script>
  async function getDialog() {
    try {
      // Initialize the SDK inside a Bitrix24 frame
      const $b24 = await B24Js.initializeB24Frame()

      const response = await $b24.actions.v2.call.make({
        method: 'imopenlines.dialog.get',
        params: {
          USER_CODE: 'livechat|1|1373|211',
        },
        requestId: B24Js.Text.getUuidRfc4122()
      })

      // The payload is available only on a successful response
      if (!response.isSuccess) {
        console.error(response.getErrorMessages().join('; '))
        return
      }

      const result = response.getData().result
      console.info(result.id, result.name, result.dialog_id)
    } catch (error) {
      // Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
      console.error(error)
    }
  }

  document.addEventListener('DOMContentLoaded', getDialog)
</script>
```

### Python

```python
from b24pysdk.errors import BitrixAPIError, BitrixSDKException

try:
    bitrix_response = client.imopenlines.dialog.get(
        user_code="livechat|1|1373|211",
    ).response
    result = bitrix_response.result
    print(result)
except BitrixAPIError as error:
    print(
        "Ошибка Bitrix API",
        f"error: {error.error}",
        f"error_description: {error.error_description}",
        sep="\n",
    )
except BitrixSDKException as error:
    print(f"Ошибка Bitrix SDK: {error.message}")
except Exception as error:
    print(f"Непредвиденная ошибка: {error}")
```

### PHP

```php
try {
    $response = $b24Service
        ->core
        ->call(
            'imopenlines.dialog.get',
            [
                'USER_CODE' => 'livechat|1|1373|211',
            ]
        );

    $result = $response
        ->getResponseData()
        ->getResult();

    if ($result->error()) {
        echo 'Error: ' . $result->error();
    } else {
        echo 'Success: ' . print_r($result->data(), true);
    }
} catch (Throwable $exception) {
    error_log($exception->getMessage());
    echo 'Error getting dialog: ' . $exception->getMessage();
}
```

### BX24.js

```js
BX24.callMethod(
    'imopenlines.dialog.get',
    {
        USER_CODE: 'livechat|1|1373|211',
    },
    function(result) {
        if (result.error()) {
            console.error(result.error().ex);
        } else {
            console.log(result.data());
        }
    }
);
```

### PHP CRest

```php
require_once('crest.php');

$result = CRest::call(
    'imopenlines.dialog.get',
    [
        'USER_CODE' => 'livechat|1|1373|211',
    ]
);

if (!empty($result['error'])) {
    echo 'Error: ' . $result['error_description'];
} else {
    echo 'Success: ' . print_r($result['result'], true);
}
```

### Go

```go
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "imopenlines.dialog.get", b24.Params{
	"USER_CODE": "livechat|1|1373|211",
}, b24.WithIdempotent())
if err != nil {
	return fmt.Errorf("imopenlines.dialog.get: %w", err)
}

var item struct {
	ID              b24.ID `json:"id"`
	ParentChatID    int    `json:"parent_chat_id"`
	ParentMessageID int    `json:"parent_message_id"`
	Name            string `json:"name"`
	Owner           int    `json:"owner"`
	Extranet        bool   `json:"extranet"`
}
if err := json.Unmarshal(res.Result, &item); err != nil {
	return fmt.Errorf("разбор ответа: %w", err)
}
fmt.Println(item.ID, item.ParentChatID)
```

Оригинал в официальной документации: https://apidocs.bitrix24.ru/api-reference/imopenlines/openlines/sessions/imopenlines-dialog-get.html
