• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Message/Forward/ForwardService.php
  • Класс: BitrixImV2MessageForwardForwardService
  • Вызов: ForwardService::createCommentMessage
private function createCommentMessage(string $comment): Result
{
	$result = new Result();


	$messageConfig = [
		"MESSAGE_TYPE" => $this->toChat->getType(),
		"MESSAGE" => $comment,
		"TO_CHAT_ID" =>  $this->toChat->getChatId(),
		"FROM_USER_ID" => $this->getContext()->getUserId(),
	];

	$messageId = CIMMessenger::Add($messageConfig); //TODO replace with $chat->sendMessage

	if (!$messageId)
	{
		return $result->addError(new MessageMessageError(MessageMessageError::SENDING_FAILED));
	}

	return $result->setResult(new Message($messageId));
}