• Модуль: imopenlines
  • Путь к файлу: ~/bitrix/modules/imopenlines/lib/automaticaction/welcome.php
  • Класс: BitrixImOpenLinesAutomaticActionWelcome
  • Вызов: Welcome::automaticAddMessage
public function automaticAddMessage()
{
	$result = false;
	$isNewSession = (int)$this->session['MESSAGE_COUNT'] === 0;
	$sendWelcomeEachSession = $this->config['SEND_WELCOME_EACH_SESSION'] === 'Y';
	$isInboundCall = $this->session['MODE'] === Session::MODE_INPUT;
	$isBotAnswered = $this->session['JOIN_BOT'] ?? false;

	$isAllowedAutomaticMessage = $isInboundCall && !$isBotAnswered;
	$isNeededAutomaticMessage =
		$this->chat->isNowCreated()
		|| $this->isTextAfterWelcomeFormIsNeeded()
		|| ($isNewSession && $sendWelcomeEachSession);

	if ($isAllowedAutomaticMessage && $isNeededAutomaticMessage)
	{
		$result = $this->sendMessage();
	}

	return $result;
}