Which Event to use instead of CampaignExecutionEvent in Mautic 3 plugins?

image

I am working on a custom plugin where I need to create some custom campaign actions, I was checking upgrade document and see that campaign Execution Event is removed, however what should be used instead is not to be found.

I checked core bundle to find out what CampaignSubscribers are using and I still see Campaign Execution event being used, Now I am confused shall I use it or not.

Even though upgrade document says it was removed, it is still being used in Core classes of Mautic.

Hi @mayanktiwaridotcom,

This is a good question and unfortunately the docs are outdated. Campaigns were refactored sometime back to support processing batches of contacts for campaign actions rather than one at a time.

The new events are:
CampaignDecisionEvent → \Mautic\CampaignBundle\Event\DecisionEvent
CampaignExecutionEvent → \Mautic\CampaignBundle\Event\PendingEvent
CampaignScheduledEvent → \Mautic\CampaignBundle\Event\ScheduledEvent

The subscriber to \Mautic\CampaignBundle\CampaignEvents::CAMPAIGN_ON_BUILD needs to define a batch event via the action metadata’s “batchEventName” (“callback” and “eventName” are deprecated).

Searching PendingEvent will give you some examples Search · PendingEvent · GitHub. For example, mautic/CampaignSubscriber.php at 7a2875bc16a6de50a1803fbc41b64278ae9b5428 · mautic/mautic · GitHub.

Hope that helps!

2 Likes