Steps to Add a Subscriber to MailerLite

1. Collect the User’s Email

  • Add a step to your workflow that collects the user’s email.
  • Store the collected email in a variable named, for example, {{user.email}}.
{
  "trigger": "Collect User Email",
  "userInput": {
    "type": "email",
    "label": "Enter your email address",
    "variableName": "user.email"
  }
}

2. Add a Webhook Step

  • Insert a Webhook step after the email is collected.

3. Configure the Webhook Step

Set up the Webhook step with the following information:

Webhook Configuration:

  • Method: POST
  • URL: https://connect.mailerlite.com/api/subscribers
  • Headers: Add the following headers:
    • Content-Type: application/json
    • Authorization: Bearer YOUR_TOKEN (replace YOUR_TOKEN with your MailerLite API key)
  • Body: Configure the body as JSON with the email variable and any additional fields you want to include.
{
  "email": "{{user.email}}",
  "fields": {
    "name": "{{user.name}}"
  }
}

Example Setup:

{
  "method": "POST",
  "url": "https://connect.mailerlite.com/api/subscribers",
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TOKEN"
  },
  "body": {
    "email": "{{user.email}}",
    "fields": {
      "name": "{{user.name}}"
    }
  }
}

Note: You can find your API key in the MailerLite API settings.

4. Preview in Iframe

Ensure that the workflow is set up correctly, and test it using an iframe preview.

Iframe Example:

To preview, integrate an iframe in your testing environment. Example configuration:

<iframe
  src="https://your-app-preview-url"
  width="100%"
  height="600px"
  frameborder="0"
  allowFullScreen
></iframe>

5. Additional Fields

For more information on what fields you can add, refer to the MailerLite documentation: List All Fields.


Validation and Testing

Before deployment, verify the following:

  • Ensure the email collection step saves the email correctly into the {{user.email}} variable.
  • Validate that the Webhook request sends data accurately to MailerLite.
  • Test the iframe preview to confirm it displays as expected.

Tip: Use JSONLint to validate your JSON structure.