A WordPress plugin that integrates list subscription and unsubscription from a listmonk server using the listmonk API with Cloudflare Turnstile for spam protection and optional transactional emails from listmonk templates.
IC Listmonk API Integration – Complete Documentation
Table of Contents
📋 Overview
The IC Listmonk API Integration plugin provides seamless integration between WordPress and Listmonk, the open-source newsletter and mailing list manager. This plugin enables you to:
🎯 Subscription Forms
Add subscribe/unsubscribe forms anywhere using shortcodes
✉️ Transactional Emails
Send automated welcome and unsubscribe confirmation emails
🛡️ Spam Protection
Cloudflare Turnstile integration for bot protection
🔗 API Integration
Full Listmonk API integration with webhook support
⚙️ Requirements
WordPress Requirements
- WordPress 5.6 or higher
- PHP 7.4 or higher
- cURL enabled
Required Plugins
Simple Cloudflare Turnstile
Mandatory: This free plugin is required for spam protection
Download PluginListmonk Requirements
- Listmonk instance with API access
- API user with proper permissions
- Lists created in Listmonk
- Email templates (for transactional emails)
🚀 Installation
Step 1: Install the Plugin
- Upload the plugin files to the
/wp-content/plugins/ic-listmonk-api-integrationdirectory - Activate the plugin through the ‘Plugins’ screen in WordPress
- Or install directly via WordPress admin (if available in repository)
Step 2: Install Cloudflare Turnstile
- Install and activate “Simple Cloudflare Turnstile” from WordPress.org
- Go to Settings → Cloudflare Turnstile
- Get free Site Key and Secret Key from Cloudflare Dashboard
- Configure the Turnstile settings
Step 3: Configure Listmonk API User
In your Listmonk administration panel:
- Go to Users → Create User
- Set user type to “API”
- Assign these permissions:
lists:manage_all subscribers:get subscribers:get_all subscribers:manage subscribers:sql_query tx:send templates:get
- Generate API token and save it securely
⚙️ Configuration
Plugin Settings
Navigate to Settings → IC Listmonk API to configure:
API Configuration
- Listmonk API URL: Your Listmonk instance API URL (e.g., https://list.yoursite.com/api)
- API Username: Listmonk API username
- API Token: Generated API token
- List IDs: Comma-separated list IDs (e.g., 1,2,5)
Email Settings
- From Email: Sender email for transactional emails
- Subscribe Emails: Enable/disable welcome emails
- Unsubscribe Emails: Enable/disable unsubscribe confirmations
- Template IDs: Listmonk template IDs for emails
Security Settings
- Require Turnstile: Enable/disable CAPTCHA protection
- Debug Mode: Enable logging for troubleshooting
Finding List IDs
To find your Listmonk list IDs:
- Log into your Listmonk admin
- Go to Lists
- Note the ID numbers in the list table
- Use comma-separated format:
1,2,3
Test Connection
Use the “Test API Connection” button in settings to verify your configuration.
🎯 Usage
Subscribe Form Shortcode
Basic Usage:
[listmonk_subscribe]
Advanced Usage:
[listmonk_subscribe button_text="Join Now" placeholder="Enter your email" show_name="no" show_turnstile="yes"]
Available Attributes:
| Attribute | Description | Default | Values |
|---|---|---|---|
button_text |
Submit button text | “Subscribe” | Any text |
placeholder |
Email field placeholder | “Your email address” | Any text |
show_name |
Show name field | “yes” | “yes”, “no” |
show_turnstile |
Show Turnstile CAPTCHA | “yes” | “yes”, “no” |
Unsubscribe Form Shortcode
Basic Usage:
[listmonk_unsubscribe]
Advanced Usage:
[listmonk_unsubscribe button_text="Unsubscribe Now" placeholder="Your email to unsubscribe"]
Available Attributes:
| Attribute | Description | Default | Values |
|---|---|---|---|
button_text |
Submit button text | “Unsubscribe” | Any text |
placeholder |
Email field placeholder | “Your email address” | Any text |
show_turnstile |
Show Turnstile CAPTCHA | “yes” | “yes”, “no” |
Form Placement Examples
1. Basic Sidebar Subscription Form
Code to use in widgets or sidebar:
<div class="newsletter-widget"> <h4>Join Our Newsletter</h4> <p>Stay updated with our latest news.</p> [listmonk_subscribe button_text="Subscribe" show_name="no"] </div>
Result:
2. Full-Featured Page Form
Code for dedicated subscription page:
<div class="subscription-page">
<h2>Subscribe to Our Mailing List</h2>
<p>Get exclusive content and updates delivered to your inbox.</p>
[listmonk_subscribe
button_text="Join Now"
placeholder="Enter your best email"
show_name="yes"
show_turnstile="yes"]
</div>
Result:
Subscribe to Our Mailing List
Get exclusive content and updates delivered to your inbox.
3. Minimal Footer Form
Code for footer or compact spaces:
<div class="footer-newsletter">
<h5>Newsletter</h5>
[listmonk_subscribe
button_text="→"
placeholder="Email"
show_name="no"
show_turnstile="no"]
</div>
Result:
4. Unsubscribe Form
Code for unsubscribe pages:
<div class="unsubscribe-form">
<h3>Unsubscribe from Emails</h3>
<p>We're sorry to see you go! Enter your email to unsubscribe.</p>
[listmonk_unsubscribe
button_text="Unsubscribe Now"
placeholder="Your email address"]
</div>
Result:
Unsubscribe from Emails
We’re sorry to see you go! Enter your email to unsubscribe.
Custom Styling Examples
Custom CSS for Form Styling:
/* Custom form styling */
.listmonk-custom-form input[type="email"],
.listmonk-custom-form input[type="text"] {
padding: 12px 15px;
margin: 8px 0;
width: 100%;
max-width: 400px;
border: 2px solid #e1e1e1;
border-radius: 6px;
font-size: 16px;
transition: border-color 0.3s ease;
}
.listmonk-custom-form input:focus {
border-color: #007cba;
outline: none;
box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}
.listmonk-custom-form button {
background: linear-gradient(135deg, #007cba, #005a87);
color: white;
padding: 12px 30px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 16px;
font-weight: 600;
transition: all 0.3s ease;
}
.listmonk-custom-form button:hover {
background: linear-gradient(135deg, #005a87, #004670);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}
.listmonk-custom-form button:disabled {
background: #ccc;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
Usage with Custom CSS:
<style>
/* Add the CSS from above */
</style>
<div class="listmonk-custom-form">
[listmonk_subscribe
button_text="Subscribe Now"
placeholder="Your email address"
show_name="yes"]
</div>
📸 Screenshot Examples
For actual implementation screenshots, you can:
- Take screenshots of the forms on your live site
- Show different form placements (sidebar, footer, dedicated page)
- Demonstrate the success/error messages
- Show the Turnstile CAPTCHA in action
Recommended screenshot locations:
- Sidebar widget with subscription form
- Full-page subscription form
- Footer subscription form
- Unsubscribe confirmation page
- Admin settings page showing configuration
🔧 Troubleshooting
Common Issues
❌ API Connection Failed
Solution:
- Verify API URL format (include /api)
- Check API username and token
- Ensure Listmonk instance is accessible
- Test connection using “Test API Connection” button
❌ Turnstile Not Working
Solution:
- Verify Simple Cloudflare Turnstile plugin is active
- Check Site Key and Secret Key configuration
- Ensure Turnstile is not blocked by ad blockers
❌ Emails Not Sending
Solution:
- Verify template IDs in settings
- Check Listmonk email configuration
- Enable debug mode to see detailed logs
❌ Form Submissions Fail
Solution:
- Check browser console for JavaScript errors
- Verify AJAX is working in WordPress
- Enable debug mode for detailed error logging
Debug Mode
Enable debug mode in plugin settings to log detailed information:
- Go to Settings → IC Listmonk API
- Check “Debug Mode”
- Check WordPress
debug.logfile for logs
Server Requirements Check
// Check if these functions are available:
curl_init()
json_encode()
wp_remote_post()
🔗 API Reference
Webhook Endpoints
The plugin provides REST API endpoints for external integrations:
Facebook Lead Ads Webhook
POST /wp-json/listmonk/v1/facebook-lead
Purpose: Handle Facebook Lead Ads form submissions
Expected Payload: Facebook webhook format with email address
AJAX Endpoints
Subscription Handler
POST /wp-admin/admin-ajax.php?action=listmonk_subscribe
Parameters: email, name, cf-turnstile-response
Unsubscription Handler
POST /wp-admin/admin-ajax.php?action=listmonk_unsubscribe
Parameters: email, cf-turnstile-response
Custom Integration Examples
Custom Form Integration:
<form id="custom-subscribe-form">
<input type="email" name="email" required>
<input type="text" name="name">
<!-- Turnstile container -->
<div class="cf-turnstile" data-sitekey="your-site-key"></div>
<button type="submit">Subscribe</button>
</form>
<script>
jQuery('#custom-subscribe-form').on('submit', function(e) {
e.preventDefault();
var formData = {
action: 'listmonk_subscribe',
email: jQuery('input[name="email"]').val(),
name: jQuery('input[name="name"]').val(),
'cf-turnstile-response': jQuery('[name="cf-turnstile-response"]').val()
};
jQuery.post('', formData, function(response) {
if (response.success) {
alert('Subscribed successfully!');
} else {
alert('Error: ' + response.data);
}
});
});
</script>
💬 Support
Getting Help
If you need assistance with the IC Listmonk API Integration plugin:
Contact Information
- Website: IC Listmonk API Integration
- Support: Contact Form
- License: GPL v2 or later
🎉 Thank You for Using Our Plugin!
We appreciate your support and are committed to providing excellent functionality for your WordPress and Listmonk integration needs.
