The add subscriber action adds subscribers to MailerLite. Under the hood, this action calls the create subscriber API endpoint. Also, you may want to add the subscriber to a group.
Adding the add subscriber action in the formspree.json
file has the same effect as adding the MailerLite plugin in the Formspree dashboard. See the MailerLite plugin help article for more information.
Formspree.json configuration
Key | Type | Description |
---|---|---|
app |
String | Must be mailerlite |
apiKey |
String | Your MailerLite API key found here (must be an $ env variable reference, required) |
type |
String | Must be addSubscriber |
groupName |
String | Optional. Group where subscribers will be added. Default: empty |
resubscribe |
Boolean | Optional. Reactivates the subscriber if the value is true. Default: false |
autoresponders |
Boolean | Optional. Enable subscription autoresponders. Only takes effect if groupName is not empty. Default: false |
subscriberStatus |
Enum | Optional. One of unsubscribed, active, or unconfirmed. Default: active |
requireOptin |
Boolean |
Optional. If true, enables the opt-in field: Submissions will only be sent to MailerLite if there is a field named _optin with a non-empty value in the data. Default: false |
Notes
autoresponders: This only takes effect if a group is selected. If it's enabled, the selected group autoresponders will be sent.
resubscribe: If it's enabled and the sent email is on your subscriber list, the Subscriber Status will be ignored and the subscriber reactivated.
Be aware that it only works for emails that once have been added to your subscriber list. For new emails, the Subscriber Status will be taken instead.
requireOptin: Instead of adding a contact to the MailerLite list each time the form is submitted, the Opt-in Checkbox setting will first check the presence of an _optin special field to determine if the plugin should be dispatched.
Example
{
"forms": {
"contact": {
"name": "Contact Form",
"actions": [
{
"app": "mailerlite",
"apiKey": "$MAILERLITE_API_KEY",
"type": "addSubscriber",
"groupName": "Formspree Test",
"resubscribe": false,
"autoresponders": false,
"subscriberStatus": "active"
"requireOptin": false
}
]
}
}
}
Validation rules
The add subscriber action adds the following validation rules implicitly:
Field | Validation Rule |
---|---|
_replyto or email |
Required |
_replyto |
Type is email |
email |
Type is email |