Email Marketing Integration Events

Use these events to extend the functionality of Freeform Email Marketing integrations:

After the response from the Email Marketing was received

This event contains the Guzzle Response object of the response received after pushing the data to the Email Marketing.

use Solspace\Freeform\Services\MailingListsService;
use Solspace\Freeform\Events\Integrations\IntegrationResponseEvent;

Event::on(
  MailingListsService::class,
  MailingListsService::EVENT_AFTER_RESPONSE,
  function (IntegrationResponseEvent $event) {
    $integration = $event->getIntegration();
    $response = $event->getResponse(); // instance of \Psr\Http\Message\ResponseInterface
    $responseAsString = $event->getResponseBodyAsString(); // Usually a stringified JSON object

    // Perform some actions here
  }
)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

Before saving an integration

use Solspace\Freeform\Services\MailingListsService;
use Solspace\Freeform\Events\Integrations\SaveEvent;

Event::on(
  MailingListsService::class,
  MailingListsService::EVENT_BEFORE_SAVE,
  function (SaveEvent $event) {
    $integrationModel = $event->getModel();
    $isNew = $event->isNew();

    // Perform some actions here
  }
)
1
2
3
4
5
6
7
8
9
10
11
12
13

After saving an integration

use Solspace\Freeform\Services\MailingListsService;
use Solspace\Freeform\Events\Integrations\SaveEvent;

Event::on(
  MailingListsService::class,
  MailingListsService::EVENT_AFTER_SAVE,
  function (SaveEvent $event) {
    $integrationModel = $event->getModel();
    $isNew = $event->isNew();

    // Perform some actions here
  }
)
1
2
3
4
5
6
7
8
9
10
11
12
13

Before deleting an integration

use Solspace\Freeform\Services\MailingListsService;
use Solspace\Freeform\Events\Integrations\DeleteEvent;

Event::on(
  MailingListsService::class,
  MailingListsService::EVENT_BEFORE_DELETE,
  function (DeleteEvent $event) {
    $integrationModel = $event->getModel();

    // Perform some actions here
  }
)
1
2
3
4
5
6
7
8
9
10
11
12

After deleting an integration

use Solspace\Freeform\Services\MailingListsService;
use Solspace\Freeform\Events\Integrations\DeleteEvent;

Event::on(
  MailingListsService::class,
  MailingListsService::EVENT_AFTER_DELETE,
  function (DeleteEvent $event) {
    $integrationModel = $event->getModel();

    // Perform some actions here
  }
)
1
2
3
4
5
6
7
8
9
10
11
12
Last Updated: 9/28/2021, 3:53:03 PM