- Модуль: salescenter
- Путь к файлу: ~/bitrix/modules/salescenter/lib/integration/crmmanager.php
- Класс: BitrixSalesCenterIntegrationCrmManager
- Вызов: CrmManager::sendCompilationBySms
public function sendCompilationBySms(int $compilationId, int $dealId, array $compilationLink, array $sendingInfo): bool
{
$linkForMessage = $compilationLink['link'];
$messageBody = str_replace(
'#LINK#',
$linkForMessage,
$sendingInfo['text']
);
$senderId = (mb_strpos($sendingInfo['provider'], '|') === false) ? $sendingInfo['provider'] : 'rest';
$messageTo = $this->getDealContactPhone($dealId);
$responsibleId = CCrmOwnerType::GetResponsibleID(CCrmOwnerType::Deal, $dealId);
$result = CrmMessageSenderMessageSender::send(
[
CrmIntegrationSmsManager::getSenderCode() => [
'ACTIVITY_PROVIDER_TYPE_ID' => BaseMessage::PROVIDER_TYPE_SALESCENTER_PAYMENT_SENT,
'MESSAGE_BODY' => $messageBody,
'SENDER_ID' => $senderId,
'MESSAGE_FROM' => $senderId === 'rest' ? $sendingInfo['provider'] : null,
]
],
[
'COMMON_OPTIONS' => [
'PHONE_NUMBER' => $messageTo,
'USER_ID' => $responsibleId,
'ADDITIONAL_FIELDS' => [
'ENTITY_TYPE' => CCrmOwnerType::ContactName,
'ENTITY_TYPE_ID' => CCrmOwnerType::Contact,
'ENTITY_ID' => $this->getPrimaryContact($dealId)['CONTACT_ID'],
'ENTITIES' => [
'DEAL' => CCrmDeal::GetByID($dealId),
],
'BINDINGS' => [
[
'OWNER_TYPE_ID' => CCrmOwnerType::Contact,
'OWNER_ID' => $this->getPrimaryContact($dealId)['CONTACT_ID']
],
[
'OWNER_TYPE_ID' => CCrmOwnerType::Deal,
'OWNER_ID' => $dealId,
]
],
'ACTIVITY_AUTHOR_ID' => $responsibleId,
'ACTIVITY_DESCRIPTION' => $messageBody,
'PRODUCT_IDS' => $compilationLink['productIds'],
'COMPILATION_ID' => $compilationId,
]
]
]
);
return $result->isSuccess();
}