Skip to content

MailerLite Automations

How to Create a MailerLite Group When an Event or Course Is Published

If every webinar, event or course gets its own audience, creating the MailerLite group by hand is the step everybody forgets. Zapify can create it the moment the post is published, with the free A post is published trigger and the Create a group action, then save the new group's ID on the post. MailerLite is a Zapify PRO integration.

What this automation does

The automation is one trigger plus two actions:

  • Trigger: A post is published (WP_POST_PUBLISHED, WordPress)
  • Action 1: Create a group (MAILERLITE_CREATE_GROUP, MailerLite)
  • Action 2: Update a post's custom field (WP_UPDATE_POST_META, WordPress)

When the post is published, Zapify creates a MailerLite group named after it and writes the new group's ID into a custom field on the post, so it can be found again.

Before you start

  • A post type for your events, webinars or courses, such as a custom post type or WooCommerce products.
  • A MailerLite account (the current MailerLite, not MailerLite Classic).
  • A MailerLite API key — create one in MailerLite under Integrations → API. MailerLite's own page for it is here.

PRO feature

MailerLite is a Zapify PRO integration and needs a Connection under Settings → Connections. The A post is published trigger used here is free.

How to build the automation

Step 1: Connect MailerLite

  1. Go to Settings → Connections and click Add New.

Open the Connections tab

  1. Choose MailerLite, paste in your API key, and name the connection something like Newsletter MailerLite.

Add the MailerLite connection

  1. Click Test. Zapify asks MailerLite to accept the key and answers MailerLite accepted the credentials. If the key is wrong it says MailerLite refused the credentials. instead, so you find out before building anything.
  2. Save.

See Connections for how this screen works generally.

Step 2: Create a new automation

  1. In the WordPress admin, go to Zapify → Automations.
  2. Click Add New to open the builder.
  3. Name it clearly, such as Create a MailerLite group for each event.

Create a new automation

Step 3: Add the "A post is published" trigger

  1. Click Add Trigger.

Add a trigger

  1. Choose WordPress as the app.

Select WordPress as the trigger

  1. Select A post is published.

Select A post is published

  1. Set the trigger's post type to your events, so ordinary blog posts do not each get a group. Filtering the trigger this way is free.

Step 4: Add the "Create a group" action

  1. Click Add Action.

Add an action

  1. Choose MailerLite as the app.

Select MailerLite as the action

  1. Select Create a group.

Select Create a group

Step 5: Configure the action

Field Required What it does
Connection Yes The MailerLite connection from Step 1.
Group name Yes Insert the Post title token, so the group is named after the event.

Step 6: Add the "Update a post's custom field" action

  1. Click Add Action.

Add an action

  1. Choose WordPress as the app.

Select WordPress as the action

  1. Select Update a post's custom field.

Select Update a post's custom field

Step 7: Configure the action

Field Required What it does
Post ID Yes Insert the trigger's Post ID token.
Meta key Yes A name you will recognise, such as mailerlite_group_id. Do not start it with an underscore.
Value No Insert the Group ID token that the Create a group action makes available.

Step 8: Set the steps Live and save

Each trigger and action has its own Live / Off / Draft switch. A new automation starts as a Draft and does nothing until its steps are Live.

  1. Set the trigger and every action to Live.
  2. Click Save.

Set the automation live

Step 9: Test it

Publish a test event. Check that MailerLite has a group with its title, and that the post has the custom field holding the group ID. Zapify → Logs shows The group "…" was created.

Tokens you can use

The A post is published trigger exposes the published post and its author:

Token What it holds
Post ID The post's numeric ID
Post title The post title
Post URL The post's permalink
Post type The post type (post, page, custom)
Post status The post's status
Post content / Post excerpt The body and excerpt
Post date The publish date
Post author ID / Post author email The author's ID and email
Featured image URL The featured image, if set
User email, Display name, First name … The post author's user fields

Create a group makes the Group ID token available to later actions, which is how the second action saves it on the post.

Conclusion

With the A post is published trigger and the Create a group action, every event starts with an audience of its own. The group picker on the other MailerLite actions also accepts a Group ID token, so a later step in the same automation can add subscribers to the group you just made.

FAQs

Is this free in Zapify?

The trigger is free. The MailerLite actions need an active Zapify PRO licence and a Connection.

Can I add people to the new group in the same automation?

Yes. Add a MailerLite → Add a subscriber to a group action after Create a group, and put the Group ID token in its Group field instead of choosing a group from the list.

What if a group with that name already exists?

MailerLite creates another group with the same name. Use a distinctive title, or filter the trigger so it only runs once per post.

Will it run again when I update the post?

No. A post is published fires when the post is published, not on every edit.

Why is my new group or custom field not in the dropdown?

Zapify keeps the groups and fields it reads from MailerLite for a minute, so the builder does not call MailerLite on every dropdown. Wait a moment and reopen the field. If the dropdown stays empty, use Test on the connection, because an unreachable MailerLite gives an empty list.

Does this work with MailerLite Classic?

No. Zapify uses MailerLite's current API, and the older Classic API is not supported. Create the API key in the current MailerLite under Integrations → API.

Do I need to write any code?

No. The API key is the only thing you copy from outside Zapify.

Was this page helpful?