Documentation on campaign decision outdated? If so, How to trigger a decision from a custom API endpoint?

Okay I have updates on this.

I my case I have an input in my form and I must only trigger events if the parameter in the request is the same as the parameter in the form. I think this would be pretty common in most of the cases.

I refactored my example code to and replace parameters to placeholders that everybody can understand, replaced debtorid by leadId and checkpoint by myparameter, this would be easier for other users to follow and is better suited for an example.

The strategy is basically the same, the difference is that now I have an arbitrary number parameter in decision form

And I send the same myparameter in the request, here is an example using curl

  • In API controller I use $leadId.$myparameter as channel id, and pass this to $realTimeExecutioner->execute(..., $channelId)
  • In the decision handler at CampaignSubscriber.php I take the lead id from the event and the My parameter from the form, and use these to create a channel id too. Then I retrieve the $channelId from RealtimeExecutioner at $event->getLog()->getChannelId()
  • I use both channel id to decide between calling $event->setResult(true) or $event->setResult(false)

With this I could accomplish the task of triggering an event based on comparing some input in the decision form and the request, but for me it seems that I’m misusing the channel id.

In RealTimeExecutioner it checks for the channel id and only executes if it matches, the problem here is that my campaign event doesn’t have channel id setted and I don’t really know how to set it since it would be distinct for each {lead, my parameter}, tuple.

Am I misusing the channel id? And should I use passtrough for doing the same thing?

Now diving more in the code, here is the controller

And here is the decision handler, I think these are the more important parts of the code

Everything is the github at GitHub - dhilst/HelloWorldBundle at make-decision-work (not master!)