-
Notifications
You must be signed in to change notification settings - Fork 0
Email Providers
Presto Player Pro can gate video access behind an email collection form. Captured emails are forwarded to integrated marketing platforms.
| Provider | Service Class | REST Controller |
|---|---|---|
| ActiveCampaign | Services\ActiveCampaign\ActiveCampaign |
RestActiveCampaignController |
| Mailchimp | Services\Mailchimp\Mailchimp |
RestMailchimpController |
| MailerLite | Services\MailerLite\MailerLite |
RestMailerLiteController |
| FluentCRM | Services\FluentCRM\FluentCRM |
RestFluentCRMController |
| Webhooks | Services\Webhooks\Webhooks |
RestWebhooksController |
FluentCRM is automatically marked as connected if the FluentCRM plugin is active (no API key needed).
All email providers extend the EmailProvider abstract class and implement EmailProviderInterface:
interface EmailProviderInterface {
public function handle( array $data, object $preset ): bool;
}
abstract class EmailProvider implements EmailProviderInterface {
// Registered on presto_player/pro/forms/save action
public function register(): void {
add_action( 'presto_player/pro/forms/save', [ $this, 'maybeHandle' ], 10, 2 );
}
public function maybeHandle( array $data, object $preset ): void {
// Check provider is connected before delegating to handle()
if ( ! Setting::get( $this->key, 'connected' ) ) {
return;
}
$this->handle( $data, $preset );
}
}Each provider's handle() method calls the provider's API via its *Request library class.
- Video plays; gate overlay appears based on
behaviorsetting (before,after,percentage) - Viewer enters email and submits
- WordPress fires
do_action('presto_player/pro/forms/save', $data, $preset) - Each active provider's
maybeHandle()runs in sequence - Connected providers forward the email to their API
- Email is stored locally in
presto_player_email_collectiontable - Webhook triggers fire if webhooks are configured
Emails collected by the gate are stored in presto_player_email_collection. See Database-Schema for full column list.
Key fields: behavior, percentage, allow_skip, email_provider, email_provider_list, email_provider_tag.
Each provider has a request library that extends ApiRequest:
Libraries/
├─ ActiveCampaignRequest.php
├─ MailchimpRequest.php
├─ MailerLiteRequest.php
└─ FluentCRMRequest.php
ApiRequest base class provides: get(), post(), put(), patch(), delete() with JSON encoding and error handling.
Webhooks send a POST (or custom method) to a configured URL on each email submission.
Configuration stored in presto_player_webhooks table:
| Field | Description |
|---|---|
url |
Target endpoint |
method |
HTTP method |
email_name |
Key name for the email field in the payload |
headers |
Custom request headers (JSON) |
Multiple webhooks can be configured and all fire on each email collection event.
Collected emails can be exported as CSV via Services\EmailExport. The export endpoint is available in the Presto Player admin under Settings → Email Collection.
- Create a class extending
EmailProviderin your own plugin - Implement
handle(array $data, object $preset): bool - Register it as a component via the
presto_player_pro_componentsfilter:
add_filter( 'presto_player_pro_components', function( $components ) {
$components[] = MyCustomProvider::class;
return $components;
} );Presto Player | Presto Player Pro | prestoplayer.com | PHP 7.3+ | WordPress 6.3+