getContent(); if (!empty($content)) { $data = json_decode($content, true); // 2nd param to get as array } else { return new Response('ERROR'); } $integration = 'Hubspot'; $integrationObject = $integrationHelper->getIntegrationObject($integration); \assert($integrationObject instanceof HubspotIntegration); foreach ($data as $info) { $object = explode('.', $info['subscriptionType']); $id = $info['objectId']; try { switch ($object[0]) { case 'contact': $executed = []; $integrationObject->getLeads($id, null, $executed); break; case 'company': $integrationObject->getCompanies($id); break; } } catch (\Exception $ex) { $mauticLogger->log('error', 'ERROR on Hubspot webhook: '.$ex->getMessage()); } } return new Response('OK'); } }