im.recent.get
Получить сокращенный список последних чатов
Описание
Метод im.recent.get получает список последних чатов пользователя.
Параметры
SKIP_OPENLINES
string
необязательный
Пропустить чаты открытых линий.
Возможные значения:
- Y — да
- N — нет
SKIP_CHAT
string
необязательный
Пропустить групповые чаты.
Возможные значения:
- Y — да
- N — нет
SKIP_DIALOG
string
необязательный
Пропустить диалоги один-на-один.
Возможные значения:
- Y — да
- N — нет
LAST_UPDATE
datetime
необязательный
Сделать выборку с указанной даты в формате ATOM (ISO-8601)
ONLY_OPENLINES
string
необязательный
Выбрать только чаты открытых линий.
Возможные значения:
- Y — да
- N — нет
LAST_SYNC_DATE
datetime
необязательный
Дата предыдущей выборки в формате ATOM (ISO-8601) для загрузки изменений, которые произошли в списке с указанной даты.
Выборка возвращает данные не старше 7 дней
Примеры запроса
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"SKIP_OPENLINES":"Y","LAST_UPDATE":"2026-02-25T18:30:00+01:00"}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/im.recent.get
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"SKIP_OPENLINES":"Y","LAST_UPDATE":"2026-02-25T18:30:00+01:00","auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/im.recent.get
// 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 each item returned in result[]
type ImRecentItem = {
id: string
chat_id: number
type: string
title: string
counter: number
last_id: number
pinned: boolean
unread: boolean
has_reminder: boolean
date_update: ISODate
date_last_activity: ISODate
avatar: {
url: string
color: string
}
message: {
id: number
text: string
file: boolean
author_id: number
attach: boolean
sticker: number | null
date: ISODate
status: string
uuid: string | null
}
chat: Record<string, unknown>
user: { id: number }
options: unknown[]
}
try {
const response = await $b24.actions.v2.call.make<ImRecentItem[]>({
method: 'im.recent.get',
params: {
SKIP_OPENLINES: 'Y',
LAST_UPDATE: '2026-02-25T18:30:00+01:00',
},
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('Recent chats count:', result.length, 'First chat title:', result[0]?.title)
}
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
<!-- 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 getRecentChats() {
try {
// Initialize the SDK inside a Bitrix24 frame
const $b24 = await B24Js.initializeB24Frame()
const response = await $b24.actions.v2.call.make({
method: 'im.recent.get',
params: {
SKIP_OPENLINES: 'Y',
LAST_UPDATE: '2026-02-25T18:30:00+01:00',
},
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('Recent chats count:', result.length, 'First chat title:', result[0]?.title)
} catch (error) {
// Thrown on transport or SDK failures (AjaxError, SdkError, etc.)
console.error(error)
}
}
document.addEventListener('DOMContentLoaded', getRecentChats)
</script>
from b24pysdk.errors import BitrixAPIError, BitrixSDKException
try:
bitrix_response = client.im.recent.get(
skip_openlines=True,
last_update="2026-02-25T18:30:00+01:00",
).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}")
try {
$response = $b24Service
->core
->call(
'im.recent.get',
[
'SKIP_OPENLINES' => 'Y',
'LAST_UPDATE' => '2026-02-25T18:30:00+01:00',
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Success: ' . print_r($result, true);
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error: ' . $e->getMessage();
}
BX24.callMethod(
'im.recent.get',
{
SKIP_OPENLINES: 'Y',
LAST_UPDATE: '2026-02-25T18:30:00+01:00'
},
function(result)
{
if (result.error())
{
console.error(result.error());
}
else
{
console.log(result.data());
}
}
);
require_once('crest.php');
$result = CRest::call(
'im.recent.get',
[
'SKIP_OPENLINES' => 'Y',
'LAST_UPDATE' => '2026-02-25T18:30:00+01:00',
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
// client и ctx уже созданы — см. раздел «SDK для Go»
res, err := client.Core().Call(ctx, "im.recent.get", b24.Params{
"SKIP_OPENLINES": "Y",
"LAST_UPDATE": "2026-02-25T18:30:00+01:00",
}, b24.WithIdempotent())
if err != nil {
return fmt.Errorf("im.recent.get: %w", err)
}
var items []struct {
ID string `json:"id"`
ChatID int `json:"chat_id"`
Type string `json:"type"`
Title string `json:"title"`
Counter int `json:"counter"`
LastID int `json:"last_id"`
}
if err := json.Unmarshal(res.Result, &items); err != nil {
return fmt.Errorf("разбор ответа: %w", err)
}
for _, it := range items {
fmt.Println(it.ID, it.ChatID)
}
Ответ
HTTP-статус: 200
{
"result": [
{
"id": "chat1451",
"chat_id": 1451,
"type": "chat",
"avatar": {
"url": "",
"color": "#df532d"
},
"title": "Максимально полный шаблон задачи",
"message": {
"id": 84501,
"text": "Иван Иванов создал задачу [Вложение]",
"file": false,
"author_id": 0,
"attach": true,
"sticker": null,
"date": "2026-02-26T00:01:26+03:00",
"status": "received",
"uuid": null
},
"counter": 0,
"last_id": 84501,
"pinned": false,
"unread": false,
"has_reminder": false,
"date_update": "2026-02-26T00:01:26+03:00",
"date_last_activity": "2026-02-26T00:01:26+03:00",
"chat": {
"id": 1451,
"parent_chat_id": 0,
"parent_message_id": 0,
"name": "Максимально полный шаблон задачи",
"owner": 503,
"extranet": false,
"contains_collaber": false,
"avatar": "",
"color": "#df532d",
"type": "tasksTask",
"entity_type": "TASKS_TASK",
"entity_id": "8293",
"entity_data_1": "",
"entity_data_2": "",
"entity_data_3": "",
"mute_list": [],
"manager_list": [
503
],
"date_create": "2026-02-26T00:01:26+03:00",
"message_type": "X",
"user_counter": 4,
"restrictions": {
"avatar": true,
"rename": true,
"extend": true,
"call": true,
"mute": true,
"leave": true,
"leave_owner": true,
"send": true,
"user_list": true
},
"role": "OWNER",
"text_field_enabled": true,
"background_id": null,
"entity_link": {
"type": "TASKS",
"url": "/company/personal/user/503/tasks/task/view/8293/?ta_sec=chat_tasks&ta_el=view_button",
"id": "8293"
},
"permissions": {
"manage_users_add": "member",
"manage_users_delete": "manager",
"manage_ui": "member",
"manage_settings": "owner",
"manage_messages": "member",
"can_post": "member"
},
"public": ""
},
"user": {
"id": 0
},
"options": []
},
{
"id": "chat1449",
"chat_id": 1449,
"type": "chat",
"avatar": {
"url": "",
"color": "#ab7761"
},
"title": "Максимально полный шаблон задачи",
"message": {
"id": 84499,
"text": "Иван Иванов создал задачу [Вложение]",
"file": false,
"author_id": 0,
"attach": true,
"sticker": null,
"date": "2026-02-26T00:01:25+03:00",
"status": "received",
"uuid": null
},
"counter": 0,
"last_id": 84499,
"pinned": false,
"unread": false,
"has_reminder": false,
"date_update": "2026-02-26T00:01:25+03:00",
"date_last_activity": "2026-02-26T00:01:25+03:00",
"chat": {
"id": 1449,
"parent_chat_id": 0,
"parent_message_id": 0,
"name": "Максимально полный шаблон задачи",
"owner": 503,
"extranet": false,
"contains_collaber": false,
"avatar": "",
"color": "#ab7761",
"type": "tasksTask",
"entity_type": "TASKS_TASK",
"entity_id": "8291",
"entity_data_1": "",
"entity_data_2": "",
"entity_data_3": "",
"mute_list": [],
"manager_list": [
503
],
"date_create": "2026-02-26T00:01:25+03:00",
"message_type": "X",
"user_counter": 4,
"restrictions": {
"avatar": true,
"rename": true,
"extend": true,
"call": true,
"mute": true,
"leave": true,
"leave_owner": true,
"send": true,
"user_list": true
},
"role": "OWNER",
"text_field_enabled": true,
"background_id": null,
"entity_link": {
"type": "TASKS",
"url": "/company/personal/user/503/tasks/task/view/8291/?ta_sec=chat_tasks&ta_el=view_button",
"id": "8291"
},
"permissions": {
"manage_users_add": "member",
"manage_users_delete": "manager",
"manage_ui": "member",
"manage_settings": "owner",
"manage_messages": "member",
"can_post": "member"
},
"public": ""
},
"user": {
"id": 0
},
"options": []
}
],
"time": {
"start": 1772086038,
"finish": 1772086038.652287,
"duration": 0.6522870063781738,
"processing": 0,
"date_start": "2026-02-26T09:07:18+03:00",
"date_finish": "2026-02-26T09:07:18+03:00",
"operating_reset_at": 1772086638,
"operating": 0
}
}
Возвращаемые данные
result
array
Список последних диалогов (подробное описание)
time
time
Информация о времени выполнения запроса
Обработка ошибок
HTTP-статус: 401
{
"error": "INVALID_CREDENTIALS",
"error_description": "Invalid request credentials"
}

