Closed michaelmcandrew closed 2 months ago
FWIW, the RunEvent
is probably a little more on-the-nose for this case, but it was missing from the docs.
Added: https://docs.civicrm.org/flexmailer/en/latest/develop/RunEvent/
Closing this issue as I am archiving this repo - please open an issue on https://lab.civicrm.org/extensions/civicrm-recalculate-recipients and reference this issue if you'd like to continue the discussion.
From a Mattermost chat with @totten...
@michaelmcandrew My use of the API wrapper on job.process_mailings was a second choice - ideally, I would have liked to have a hook / event that is called exactly once just before starting a mailing.
But I couldn't find one in the current code base. Maybe there is such an event in Flexmailer?
@totten WalkBatchesEvent ( https://docs.civicrm.org/flexmailer/en/latest/develop/ ) might be a bit closer. It fires at the start of a job.
if there are cases of multiple-jobs for the same mailing, this wouldn't distinguish those implicitly. you'd have to do some kind of sql query. (edited)
in the example snippet of https://docs.civicrm.org/flexmailer/en/latest/develop/WalkBatchesEvent/, the example_civicrm_container() would be representative. but the _example_walk_batches() would be more like