MailPoet – Documentation for Integrators
This is a place where we put documentation for developers who want to build an extension for MailPoet plugin. If you are a user looking for a user guide please visit our knowledge base.
MailPoet API
MailPoet API is the officially supported way to integrate with the MailPoet plugin. It focuses on functionality for managing subscribers. Developers integrating MailPoet functionality in their own plugins or projects are strongly discouraged against using other functions and classes within MailPoet codebase! We are continually refactoring as part of our rapid development process, and backward compatibility is not guaranteed.
Basics
MailPoet API is distributed within MailPoet3 plugin and it is implemented as a PHP class.
Currently supported version is v1
.
Instantiation
if (class_exists(\MailPoet\API\API::class)) {
$mailpoet_api = \MailPoet\API\API::MP('v1');
}
Class \MailPoet\API\API
becomes available once MailPoet plugin is loaded by WordPress.
Available API Methods
- Add List (addList)
- Add Subscriber (addSubscriber)
- Update Subscriber (updateSubscriber)
- Add Subscriber Field (addSubscriberField)
- Delete List (deleteList)
- Get Lists (getLists)
- Get Subscriber (getSubscriber)
- Get Subscribers (getSubscribers)
- Get Subscribers Count (getSubscribersCount)
- Get Subscriber Fields (getSubscriberFields)
- Is Setup Complete (isSetupComplete)
- Subscribe to List (subscribeToList)
- Subscribe to Lists (subscribeToLists)
- Unsubscribe globally
- Unsubscribe from List (unsubscribeFromList)
- Unsubscribe from Lists (unsubscribeFromLists)
- Update List (updateList)
Usage examples
You can check some basic examples here.