Integrations
WordPress Subscriber Sync
The Integration Approach
AcelleMail exposes a REST API that you can call from WordPress hooks. The simplest pattern: when a user registers on WordPress, push them to an AcelleMail list via API.
PHP Hook Example
Add this to your theme's functions.php or a custom plugin:
add_action('user_register', function($user_id) {
$user = get_userdata($user_id);
$response = wp_remote_post('https://mail.yourdomain.com/api/v1/subscribers', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_TOKEN',
'Content-Type' => 'application/json',
],
'body' => json_encode([
'email' => $user->user_email,
'first_name' => $user->first_name,
'list_uid' => 'YOUR_LIST_UID',
]),
]);
});
Replace YOUR_API_TOKEN with a token from AcelleMail → API Tokens and YOUR_LIST_UID with the list UID from Lists → Overview.
Handling Unsubscribes
To keep both platforms in sync, listen for AcelleMail's unsubscribe webhook and update WordPress user meta:
// In a webhook handler endpoint
$payload = json_decode(file_get_contents('php://input'), true);
if ($payload['event'] === 'unsubscribe') {
$user = get_user_by('email', $payload['subscriber']['email']);
if ($user) {
update_user_meta($user->ID, 'newsletter_subscribed', '0');
}
}
WooCommerce Checkout Opt-in
For WooCommerce, add a checkbox at checkout and subscribe on order completion:
add_action('woocommerce_checkout_after_terms_and_conditions', function() {
echo '<p><label><input type="checkbox" name="subscribe_newsletter" value="1"> Subscribe to newsletter</label></p>';
});