We have a full video tutorial and cloneable specifically for Webflow + MailerLite, using Logic. Click the button above.
MailerLite is an email marketing service. Typical functions you'd want to trigger from your website include;
- Add subscriber
- Add subscriber to group
- Remove subscriber
NOTE: currently there are two versions, referred to as MailerLIte New version, and MailerLite Classic. The docs here have only been tested with the new version.
Authentication
Get your MailerLite API key
- In MailerLite, visit the Integrations / API page
- Click Generate new token
- Name it something recognizable, like your site's domain name
- Copy that key somewhere safe, like a password keeper. It's long. Note that you won't be able to view it again in MailerLite.
Setup HTTP Request Block in Logic
In your Webflow Logic flow, create a Make HTTP Request block where you want this step to occur.
Use these settings;
- Authentication - select API token
- Add to - select Header
- Header - enter Authorization
- Credential - create as follows;
- > Name - anything you like
- > Type - API token
- > Token - Bearer YOUR-TOKEN-ID
- >> Make certain to have Bearer first, with one space following
- >> After that, paste in your long MailerLite token
Common Uses
Add Subscriber
- Request method - select POST
- URL - enter https://connect.mailerlite.com/api/subscribers
- Headers - add
- > Content-Type : application/json
The request body will be JSON.
The minimum you need to add a subscriber is the email, e.g;
{
"email": "(insert email field here)"
}
If you also want to add a name,
{
"email": "(insert email field here)",
"fields": {
"name": "(insert subscriber's name field here)"
}
}
The Body field starts as one line, but will automatically expand to fit the content you type or paste in.
NOTE: In most services, first name and last name are separated. In an email newsletter, if you started it with "Hey Bob!", you'd just want the first name. Until Logic has a Formatting or Script block, capability, the easiest way to do this is at the point of data capture. In your originating form, simply ask for the First Name rather than Name, to get the data that best fits your needs here.
Use the purple + Insert Variable icon in the top-right of the Body field to insert the data for each field.
Add Subscriber to Group
If you also want to specify one or more mailing list groups to add the subscriber to,
{
"email": "(insert email field here)",
"fields": {
"name": "(insert subscriber's name field here)"
},
"groups": [
"(enter group 1 ID here)",
"(enter group 2 ID here)"
]
}
NOTE: The groups section is an array. In JSON, arrays are wrapped in square brackets.
You can get your MailerLite group ID by viewing that group in the MailerLite admin console Under Subscribers / Groups.
Click View Group, and scroll all the way to the end of the URL. You'll see a segment of the URL that looks like this;
group=75172115177801847
The numeric part is your Group ID.
You can add a new subscriber to several groups, by comma-separating these group ID's
Resources
FAQs
Answers to frequently asked questions.