• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/messagesender/sendfacilitator.php
  • Класс: Bitrix\Crm\MessageSender\SendFacilitator
  • Вызов: SendFacilitator::prepareMessageOptions
protected function prepareMessageOptions(): array;

protected function prepareMessageCommonOptions(): array
{
	return [
		'PHONE_NUMBER' => $this->getTo()->getAddress()->getValue(),
		'USER_ID' => $this->channel->getUserId(),
		'ADDITIONAL_FIELDS' => array_merge(
			$this->additionalFields,
			[
				'ROOT_SOURCE' => $this->getTo()->getRootSource()->toArray(),
				'ADDRESS_SOURCE' => $this->getTo()->getAddressSource()->toArray(),
				// to create activities on these items
				'BINDINGS' => [
					[
						'OWNER_TYPE_ID' => $this->getTo()->getRootSource()->getEntityTypeId(),
						'OWNER_ID' => $this->getTo()->getRootSource()->getEntityId(),
					],
					[
						'OWNER_TYPE_ID' => $this->getTo()->getAddressSource()->getEntityTypeId(),
						'OWNER_ID' => $this->getTo()->getAddressSource()->getEntityId(),
					],
				],
				// it's passed to an activity's COMMUNICATION field
				'ENTITY_TYPE' => \CCrmOwnerType::ResolveName($this->getTo()->getAddressSource()->getEntityTypeId()),
				'ENTITY_TYPE_ID' => $this->getTo()->getAddressSource()->getEntityTypeId(),
				'ENTITY_ID' => $this->getTo()->getAddressSource()->getEntityId(),
			],
		),
	];
}