3namespace Bitrix\Seo\LeadAds\Services;
5use Bitrix\Main\Application;
6use Bitrix\Main\Context;
9use Bitrix\Main\Security\Random;
10use Bitrix\Seo\WebHook;
11use Bitrix\Seo\LeadAds;
12use Bitrix\Seo\LeadAds\Account;
13use Bitrix\Seo\Retargeting\Response;
14use Bitrix\Seo\Retargeting;
15use Bitrix\Seo\Service;
16use PhpParser\Node\Expr\Isset_;
31 public const URL_INFO =
'https://vk.com/page-19542789_53868676';
48 while ($row = $list->fetch())
50 if ($row[
'ID'] === $id)
68 'methodName' =>
'leadads.groups.list',
69 'parameters' =>
array(
70 'fields' =>
'id,name',
91 'methodName' =>
'leadads.profile',
99 'NAME' =>
$data[
'FIRST_NAME'] .
' ' .
$data[
'LAST_NAME'],
102 $result[
'LINK'] =
'https://ads.vk.com/hq/leadforms/';
103 $result[
'PICTURE'] = (Context::getCurrent()->getRequest()->isHttps() ?
'https' :
'http')
105 . Context::getCurrent()->getServer()->getHttpHost() .
'/bitrix/images/seo/integration/vklogo.svg';
121 if (isset(
$data[
'hasAuthInfo']) && isset(
$data[
'hasProfile']))
123 if (!
$data[
'hasAuthInfo'])
128 return $data[
'hasProfile'];
140 if (isset(
$data[
'id']) && isset(
$data[
'type']))
145 if (isset(
$data[
'form_ids']) && is_array(
$data[
'form_ids']))
147 return (
new Result())->setData([
'formIds' =>
$data[
'form_ids']]);
159 return $this->registerCode((
int)
$response->getData()[
'id'], self::RESOURCE_LEAD);
162 return (
new Result())->addError(
new Error(
'Failed to perform all actions after authorization'));
173 $webhookQueryParams = http_build_query(
176 'action' =>
'web_hook',
181 'methodName' =>
'leadads.subscribe.lead.add',
183 'resource' => $resource,
184 'callback_url' =>
"{$remoteServiceUrl}/register/?{$webhookQueryParams}",
189 private function registerCode(
int $confirmCode,
string $resource)
195 'SECURITY_CODE' => Random::getString(32),
196 'CONFIRMATION_CODE' => $resource,
215 )->register($parameters);
221 'methodName' =>
'leadads.unsubscribe.lead.add',
231 WebHook\Internals\WebHookTable::delete($webHook[
'ID']);
239 return WebHook\Internals\WebHookTable::getRow([
241 'EXTERNAL_ID' => $externalId,
250 'methodName' =>
'leadads.account.check.auth',
static getEngineCode($type)
unregisterCode(int $externalId, string $type)
unsubscribeToLeadAdding()
subcribeToLeadAdding(string $resource)
getWebHookByExternalId($externalId, $type)
registerWebHook($confirmCode, array $parameters=[])
static create($type, $externalId)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)