Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
chat.php
1<?php
2
4
5use Bitrix\Im;
7
8class Chat extends Base
9{
10 public function createAction(array $userIds): int
11 {
12 if (!Loader::includeModule('im'))
13 {
14 return 0;
15 }
16
17 $result = Im\V2\Chat\ChatFactory::getInstance()->addChat([
18 'TYPE' => Im\V2\Chat::IM_TYPE_CHAT,
19 'SKIP_ADD_MESSAGE' => 'Y',
20 'AUTHOR_ID' => $this->userId,
21 'USERS' => $userIds,
22 ]);
23
24 return $result->getData()['RESULT']['CHAT_ID'];
25 }
26}