• Модуль: imconnector
  • Путь к файлу: ~/bitrix/modules/imconnector/lib/connectors/facebook.php
  • Класс: BitrixImConnectorConnectorsFacebook
  • Вызов: Facebook::processingInputNewMessage
public function processingInputNewMessage($message, $line): Result
{
	$catalogProducts = $message['message']['attachments']['catalog'];
	if (is_array($catalogProducts) && count($catalogProducts) > 0)
	{
		$message['message']['text'] = Loc::getMessage('IMCONNECTOR_FACEBOOK_ADDITIONAL_DATA');

		$blocks = [];
		foreach ($catalogProducts as $catalogProduct)
		{
			if ($catalogProduct['image_url'])
			{
				$blocks[] = ["IMAGE" => ['LINK' => $catalogProduct['image_url']]];
			}
			if ($catalogProduct['title'])
			{
				$blocks[] = ["MESSAGE" => $catalogProduct['title']];
			}
			if ($catalogProduct['subtitle'])
			{
				$blocks[] = ["MESSAGE" => $catalogProduct['subtitle']];
			}
		}

		if (count($blocks) > 0)
		{
			$message['message']['attach'] = BitrixMainWebJson::encode(['BLOCKS' => $blocks]);
		}
	}

	return parent::processingInputNewMessage($message, $line);
}