• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Link/Pin/PinService.php
  • Класс: BitrixImV2LinkPinPinService
  • Вызов: PinService::sendMessageAboutPin
protected function sendMessageAboutPin(PinItem $pin): Result
{
	//todo: Replace with new API
	$dialogId = Dialog::getDialogId($pin->getChatId());
	$authorId = $this->getContext()->getUserId();

	$messageId = CIMChat::AddMessage([
		'DIALOG_ID' => $dialogId,
		'SYSTEM' => 'Y',
		'MESSAGE' => $this->getMessageText($pin),
		'FROM_USER_ID' => $authorId,
		'PARAMS' => [
			'CLASS' => 'bx-messenger-content-item-system',
			'BETA' => 'Y'
		],
		'URL_PREVIEW' => 'N',
		'SKIP_CONNECTOR' => 'Y',
		'SKIP_COMMAND' => 'Y',
		'SILENT_CONNECTOR' => 'Y',
	]);

	$result = new Result();

	if ($messageId === false)
	{
		return $result->addError(new Error(''));
	}

	return $result;
}