• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/rest.php
  • Класс: BitrixImOpenLinesRest
  • Вызов: Rest::crmLastChatIdGet
static function crmLastChatIdGet($arParams, $n, CRestServer $server): int
{
	if (empty($arParams['CRM_ENTITY_TYPE']) || empty($arParams['CRM_ENTITY']))
	{
		throw new RestException('Empty CRM data', 'CRM_CHAT_EMPTY_CRM_DATA', CRestServer::STATUS_WRONG_REQUEST);
	}

	$chatId = CrmCommon::getLastChatIdByCrmEntity($arParams['CRM_ENTITY_TYPE'], $arParams['CRM_ENTITY']);

	if ($chatId === 0)
	{
		throw new RestException('Could not find CRM entity', 'CRM_CHAT_EMPTY_CRM_DATA', CRestServer::STATUS_WRONG_REQUEST);
	}

	return $chatId;
}