- Модуль: imopenlines
- Путь к файлу: ~/bitrix/modules/imopenlines/lib/automaticaction/welcome.php
- Класс: BitrixImOpenLinesAutomaticActionWelcome
- Вызов: Welcome::sendWelcomeForm
public function sendWelcomeForm(): bool
{
if (!Loader::includeModule('crm'))
{
return false;
}
$welcomeForm = new BitrixCrmWebFormForm($this->config['WELCOME_FORM_ID']);
if (!$welcomeForm->isActive())
{
return false;
}
$welcomeFormLink = BitrixCrmWebFormScript::getPublicUrl([
'ID' => $this->config['WELCOME_FORM_ID'],
'CODE' => $welcomeForm->get()['CODE'],
'SECURITY_CODE' => $welcomeForm->get()['SECURITY_CODE']
]);
$welcomeFormName = $welcomeForm->get()['NAME'];
$attach = new CIMMessageParamAttach(null, CIMMessageParamAttach::CHAT);
$attach->AddLink([
"NAME" => $welcomeFormLink,
"LINK" => $welcomeFormLink
]);
Im::addMessage([
"TO_CHAT_ID" => $this->session['CHAT_ID'],
"MESSAGE" => FormHandler::buildSentFormMessageForOperator($welcomeFormName),
"ATTACH" => $attach,
"SYSTEM" => 'Y',
"IMPORTANT_CONNECTOR" => 'Y',
'NO_SESSION_OL' => 'Y',
"PARAMS" => [
"COMPONENT_ID" => FormHandler::FORM_COMPONENT_NAME,
"IS_WELCOME_FORM" => 'Y',
"CRM_FORM_ID" => $this->config['WELCOME_FORM_ID'],
"CRM_FORM_SEC" => $welcomeForm->get()['SECURITY_CODE'],
"CRM_FORM_FILLED" => 'N'
]
]);
return true;
}