MailerLite Integration
Add a subscriber to a MailerLite group when a form is submitted.
Action type: mailerlite
Class: Core_Forms\Actions\MailerLite
Source: src/actions/class-mailerlite.php
Setup
- In MailerLite, go to Integrations > Developer API.
- Copy your API Key.
- To add subscribers to a specific group, note the Group ID (found in Groups settings).
- In WordPress, edit your form > Actions tab > Add Action > Add to MailerLite.
- Enter the API Key and optionally the Group ID.
Settings Reference
| Setting | Required | Default | Description |
|---|---|---|---|
| API Key | Yes | -- | MailerLite API key |
| Group ID | No | -- | Group ID to add the subscriber to (leave empty for no group) |
| Email Field | No | email |
Form field name containing the email address |
| Name Field | No | name |
Form field name containing the subscriber's name |
Group Assignment
If a Group ID is provided, the subscriber is added to that group via the groups array in the API payload. If left empty, the subscriber is created without any group assignment.
To find your Group ID: go to Subscribers > Groups, click on a group, and find the ID in the URL or group settings.
Subscriber Fields
The integration sends:
- email -- from the configured email field
- fields.name -- from the configured name field
MailerLite stores the name as a subscriber field, not split into first/last.
How It Works
- Validates the API key and email address.
- Builds a subscriber payload with email and name field.
- If a Group ID is provided, includes it in the
groupsarray. - POSTs to
https://connect.mailerlite.com/api/subscriberswith Bearer auth. - The request times out after 15 seconds.
- Returns
trueon success.
Example
Form with name and email fields, adding to a newsletter group:
- API Key:
your_mailerlite_api_key - Group ID:
12345678901234567 - Email Field:
email - Name Field:
name
Troubleshooting
- "Unauthorized": Ensure you are using a MailerLite Classic or MailerLite New API key. The integration uses the new MailerLite API (
connect.mailerlite.com). - Group not found: Group IDs in the new API are long numeric strings. Double-check the ID.
- Subscriber not appearing: The email may already exist. MailerLite does not duplicate subscribers but may update the existing record.
- API version: This integration uses the MailerLite new API (v2). If you are on MailerLite Classic, ensure you have migrated or are using the correct API key.