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

# MailerLite

> Add a bot to MailerLite using the official integration.

{/* vale on */}

[Open in Hub](https://studio.botpress.cloud/home?exploreHub=1\&hubItemId=intver_01K6BFZTMA8A1Z3KV1QXGWB61S)
*v3.0.2*

The official MailerLite integration allows your bot to create, update, fetch, or delete your MailerLite subscribers.

## Setup

> [!NOTE]
>
> You will need:
>
> * A [published bot](https://botpress.com/docs/get-started/quick-start.md)
> * A [MailerLite account](https://www.mailerlite.com/signup)

**1. Install the integration in Botpress**

First, install the integration to your bot:

1. In Botpress Studio, select **Explore Hub** in the upper-right corner.
2. Search for the **MailerLite** integration, then select **Install Integration**.

In the **Configuration** menu, you should see one field: **API Key**. Leave it empty for now—you'll come back to it after creating your MailerLite API key.

**2. Create a MailerLite developer API key**

Next, create a MailerLite API key:

1. [Log in to your MailerLite account](https://accounts.mailerlite.com/?lang=en).
2. Select **Integrations** from the left navigation bar.
3. To the right of **API**, select **Use**.
4. Select **Generate new token**. Enter a name, then select **Create token**.
5. Copy the API  token.

**3. Configure the integration in Botpress**

Now, you can finish setting up the integration in Botpress:

1. In the integration's **API Key** field, paste your MailerLite developer API key.
2. Select **Save Configuration**.

> [!TIP]
>
> Your MailerLite integration is ready. You can use the integration's [Cards](#cards) to interact with your MailerLite subscribers.

***

## Cards

{/* vale off */}

Here's a reference for all [Cards](https://botpress.com/docs/studio/concepts/cards/introduction.md) available with the integration:

### Delete Subscriber

Delete existing subscriber by subscriber id

**input** `object`

**id** `string` *required*

Id of the subscriber to remove

**output** `object`

**success** `boolean` *required*

Returns boolean depending on the return code of the action

**message** `string` *required*

Explains return status

### Fetch Subscriber

Search subscriber by id or by email

**input** `object`

**id** `string`

Subscriber id to search for

**email** `string`

Subscriber email to search for

**output** `object`

**subscriber** `object`

**id** `string` *required*

Unique identifier for the subscriber

**email** `string` *required*

Subscriber email address

**status** `string` *required*

Current subscription status of the subscriber

**source** `string` *required*

Source where the subscriber was acquired from

**sent** `number | null` *required*

Number of emails sent to this subscriber

**opens\_count** `number | null` *required*

Number of emails opened by this subscriber

**clicks\_count** `number | null` *required*

Number of email clicks by this subscriber

**open\_rate** `number` *required*

Email open rate percentage for this subscriber

**click\_rate** `number` *required*

Email click rate percentage for this subscriber

**ip\_address** `string | null` *required*

IP address of the subscriber

**subscribed\_at** `string` *required*

Timestamp when the subscriber was subscribed

**unsubscribed\_at** `string | null` *required*

Timestamp when the subscriber was unsubscribed

**created\_at** `string` *required*

Timestamp when the subscriber was created

**updated\_at** `string` *required*

Timestamp when the subscriber was last updated

**fields** `object` *required*

Custom fields associated with the subscriber

**city** `string | null`

**company** `string | null`

**country** `string | null`

**last\_name** `string | null`

**name** `string | null`

**phone** `string | null`

**state** `string | null`

**zip** `string | null`

**groups** `array`

Groups the subscriber belongs to

**opted\_in\_at** `string | null` *required*

Timestamp when the subscriber opted in

**optin\_ip** `string | null` *required*

IP address used during opt-in

### Upsert Subscriber

Create or update existing subscriber with given fields, identified by their email or id

**input** `object`

**email** `string` *required*

Email of the subscriber to create/upsert

**name** `string`

First name of the subscriber

**last\_name** `string`

Last name of the subscriber

**company** `string`

Company name

**country** `string`

Country

**city** `string`

City

**phone** `string`

Phone number

**state** `string`

State/Province

**zip** `string`

ZIP/Postal code

**customFields** `string`

JSON string containing key, value pairs of custom fields

**output** `object`

**id** `string` *required*

Unique identifier for the subscriber

**email** `string` *required*

Subscriber email address

**status** `string` *required*

Current subscription status of the subscriber

**source** `string` *required*

Source where the subscriber was acquired from

**sent** `number | null` *required*

Number of emails sent to this subscriber

**opens\_count** `number | null` *required*

Number of emails opened by this subscriber

**clicks\_count** `number | null` *required*

Number of email clicks by this subscriber

**open\_rate** `number` *required*

Email open rate percentage for this subscriber

**click\_rate** `number` *required*

Email click rate percentage for this subscriber

**ip\_address** `string | null` *required*

IP address of the subscriber

**subscribed\_at** `string` *required*

Timestamp when the subscriber was subscribed

**unsubscribed\_at** `string | null` *required*

Timestamp when the subscriber was unsubscribed

**created\_at** `string` *required*

Timestamp when the subscriber was created

**updated\_at** `string` *required*

Timestamp when the subscriber was last updated

**fields** `object` *required*

Custom fields associated with the subscriber

**city** `string | null`

**company** `string | null`

**country** `string | null`

**last\_name** `string | null`

**name** `string | null`

**phone** `string | null`

**state** `string | null`

**zip** `string | null`

**groups** `array`

Groups the subscriber belongs to

**opted\_in\_at** `string | null` *required*

Timestamp when the subscriber opted in

**optin\_ip** `string | null` *required*

IP address used during opt-in

***

## Triggers

{/* vale off */}

Here's a reference for all [Triggers](https://botpress.com/docs/studio/concepts/triggers.md) available with the integration:

> [!TIP]
>
> You can access data returned from any of these Triggers by reading `event.payload` after the Trigger fires.

### Subscriber Created

A new subscriber has been created in MailerLite

**payload** `object`

**id** `string` *required*

Unique identifier for the subscriber

**email** `string` *required*

Subscriber email address

**status** `string` *required*

Current subscription status of the subscriber

**source** `string` *required*

Source where the subscriber was acquired from

**sent** `number | null` *required*

Number of emails sent to this subscriber

**opens\_count** `number | null` *required*

Number of emails opened by this subscriber

**clicks\_count** `number | null` *required*

Number of email clicks by this subscriber

**open\_rate** `number` *required*

Email open rate percentage for this subscriber

**click\_rate** `number` *required*

Email click rate percentage for this subscriber

**ip\_address** `string | null` *required*

IP address of the subscriber

**subscribed\_at** `string` *required*

Timestamp when the subscriber was subscribed

**unsubscribed\_at** `string | null` *required*

Timestamp when the subscriber was unsubscribed

**created\_at** `string` *required*

Timestamp when the subscriber was created

**updated\_at** `string` *required*

Timestamp when the subscriber was last updated

**fields** `object` *required*

Custom fields associated with the subscriber

**city** `string | null`

**company** `string | null`

**country** `string | null`

**last\_name** `string | null`

**name** `string | null`

**phone** `string | null`

**state** `string | null`

**zip** `string | null`

**groups** `array`

Groups the subscriber belongs to

**opted\_in\_at** `string | null` *required*

Timestamp when the subscriber opted in

**optin\_ip** `string | null` *required*

IP address used during opt-in

***

## Troubleshooting

If you run into errors when using the integration's Cards, check out your bot's [Logs](https://botpress.com/docs/studio/concepts/debugger-logs-json.md#logs) and locate the error message:

> [accordion] An unexpected error occurred
>
> Your developer API token may have been revoked. [Create a new one](#setup) and update your bot's configuration.

> [accordion] Invalid JSON
>
> If you're passing data into the [Upsert Subscriber](#upsert-subscriber) Card's [`customFields`](#param-custom-fields) parameter, make sure it's a valid JSON string of key-value pairs..


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.