• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/leadads/services/formvkontakte.php
  • Класс: BitrixSeoLeadAdsServicesFormVkontakte
  • Вызов: FormVkontakte::registerGroupWebHook
protected function registerGroupWebHook(): RetargetingServicesResponseVkontakte
{
	$response = new RetargetingServicesResponseVkontakte();

	$confirmationCodeResponse = $this->getCallbackConfirmationCode();
	if ($confirmationCodeResponse instanceof Error)
	{
		$response->addError(
			$confirmationCodeResponse
		);

		return $response;
	}

	$isRegistered = $this->registerFormWebHook(
		$this->accountId,
		array(
			'SECURITY_CODE' => $secretKey = Random::getString(32),
			'CONFIRMATION_CODE' => $confirmationCodeResponse,
		)
	);

	if (!$isRegistered)
	{
		$response->addError(new Error('Can not register Form web hook.'));

		return $response;
	}

	$callbackServiceResponse = $this->addCallbackServer($secretKey);
	if ($callbackServiceResponse instanceof Error)
	{
		$response->addError($callbackServiceResponse);
	}

	return $response;
}