- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/V2/Link/Calendar/CalendarService.php
- Класс: BitrixImV2LinkCalendarCalendarService
- Вызов: CalendarService::sendMessageAboutCalendar
protected function sendMessageAboutCalendar(CalendarItem $calendarLink, int $chatId): Result
{
//todo: Replace with new API
$dialogId = Dialog::getDialogId($chatId);
$authorId = $this->getContext()->getUserId();
$messageId = CIMChat::AddMessage([
'DIALOG_ID' => $dialogId,
'SYSTEM' => 'Y',
'MESSAGE' => $this->getMessageText($calendarLink),
'FROM_USER_ID' => $authorId,
'PARAMS' => ['CLASS' => "bx-messenger-content-item-system"],
'URL_PREVIEW' => 'N',
'SKIP_CONNECTOR' => 'Y',
'SKIP_COMMAND' => 'Y',
'SILENT_CONNECTOR' => 'Y',
'SKIP_URL_INDEX' => 'Y',
]);
$result = new Result();
if ($messageId === false)
{
return $result->addError(new CalendarError(CalendarError::ADD_CALENDAR_MESSAGE_FAILED));
}
return $result->setResult($messageId);
}