EventListener/LeadSubscriber.php
public function doPostSaveEnhancements(LeadEvent $event)
    {
        /**
         * @var \MauticPlugin\MauticEnhancerBundle\Integration\AbstractEnhancerIntegration[]
         */
        $integrations = $this->enhancerHelper->getEnhancerIntegrations();
        foreach ($integrations as $integration) {
            if ($integration->isConfigured() && $integration->getIntegrationSettings()->getIsPublished()) {
                $keys = $integration->getKeys();
                if ($keys['autorun_enabled']) {
                    try {
                        $lead = $event->getLead();
                        $integration->doEnhancement($lead);
                    } catch (\Exception $exception) {
                        $e = new ApiErrorException(
                            'There was an issue using enhancer: '.$integration->getName(),
                            0,
                            $exception
                        );
                        if (!empty($lead)) {
                            $e->setContact($lead);
                        }
                        throw $e;
                    }
                }
            }
        }
    }
public function doPostSaveEnhancements(LeadEvent $event)
    {
        /**
         * @var \MauticPlugin\MauticEnhancerBundle\Integration\AbstractEnhancerIntegration[]
         */
        $integrations = $this->enhancerHelper->getEnhancerIntegrations();
        foreach ($integrations as $integration) {
            if ($integration->isConfigured() && $integration->getIntegrationSettings()->getIsPublished()) {
                $keys = $integration->getKeys();
                if ($keys['autorun_enabled']) {
                    try {
                        $lead = $event->getLead();
                        $integration->doEnhancement($lead);
                    } catch (\Exception $exception) {
                        $e = new ApiErrorException(
                            'There was an issue using enhancer: '.$integration->getName(),
                            0,
                            $exception
                        );
                        if (!empty($lead)) {
                            $e->setContact($lead);
                        }
                        throw $e;
                    }
                }
            }
        }
    }
@param LeadEvent $event

@throws ApiErrorException