Skip to main content

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
}
)

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
}
)

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
}
)

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
}
)

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
}
)