> ## Documentation Index
> Fetch the complete documentation index at: https://docs.release0.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to integrate your Agent with MailerLite

> Step-by-step guide to integrate MailerLite with your agent and add subscribers using webhook integration. Learn how to collect user emails and send them to MailerLite for email marketing campaigns.

## 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}}`.

```json theme={null}
{
  "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.

```json theme={null}
{
  "email": "{{user.email}}",
  "fields": {
    "name": "{{user.name}}"
  }
}
```

#### Example Setup:

```json theme={null}
{
  "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](https://app.mailerlite.com/integrations/api/).

### 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:

```html theme={null}
<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](https://developers.mailerlite.com/docs/fields.html#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](https://jsonlint.com/) to validate your JSON structure.
