Marketing · n8n

Automatically Add New Stripe Subscribers to a MailerLite Segment

When a customer starts a new subscription in Stripe, this workflow instantly adds them to a specific MailerLite segment so you can trigger onboarding emails automatically. No manual CSV exports or copy-pasting required.

difficulty Beginnersetup 30 minresult Every new Stripe subscriber is added to your chosen MailerLite segment within seconds, ready to receive your onboarding sequence.
  1. 1

    Receive the Stripe webhook

    The workflow starts with a Webhook node that listens for POST requests. Copy the generated webhook URL and paste it into your Stripe Dashboard under Developers > Webhooks. Set the event to customer.subscription.created. In n8n, set the HTTP Method to POST and note your webhook path.

  2. 2

    Extract subscriber data with a Set node

    Add a Set node after the webhook. Create three fields: email mapped to {{$json.body.data.object.customer_email}} (or use {{$json.body.data.object.customer}}), name mapped to {{$json.body.data.object.metadata.name}}, and plan mapped to {{$json.body.data.object.items.data[0].price.nickname}}. This cleans up the data before sending it to MailerLite.

  3. 3

    Check the event type with an IF node

    Add an IF node to confirm the Stripe event is exactly customer.subscription.created. Set the condition: {{$json.body.type}} equals the string customer.subscription.created. Connect the TRUE branch to the next step. This prevents test events or other event types from creating duplicate subscribers.

  4. 4

    Create or update the subscriber in MailerLite

    Add an HTTP Request node connected to the TRUE branch. Set Method to POST and URL to https://connect.mailerlite.com/api/subscribers. Under Headers, add Authorization with value Bearer YOUR_MAILERLITE_API_KEY and Content-Type as application/json. In the Body (JSON), send {"email": "{{$node['Set'].json['email']}}", "fields": {"name": "{{$node['Set'].json['name']}}"}, "groups": ["YOUR_SEGMENT_ID"]}. Replace YOUR_MAILERLITE_API_KEY and YOUR_SEGMENT_ID with your real values from MailerLite.

Frequently asked questions

Where do I find my MailerLite Segment ID?

Log in to MailerLite, go to Subscribers > Segments, click on the segment you want to use, and look at the URL in your browser. The number at the end of the URL is your Segment ID.

What if the customer email is not in the Stripe webhook payload?

Stripe sometimes sends a customer ID instead of an email directly in the subscription object. In that case, add an extra HTTP Request node before the Set node to call the Stripe API at `https://api.stripe.com/v1/customers/{{$json.body.data.object.customer}}` using Basic Auth with your Stripe secret key to retrieve the customer email.

Will this create duplicate subscribers in MailerLite?

No. MailerLite's API automatically handles duplicates by updating an existing subscriber's record if the email already exists, and simply adds them to the new segment without creating a second entry.

About this recipe. Recipes on FlowRecipesHub are written for business owners, not developers, and are tested before publishing — how recipes get made. Some ingredient links are affiliate links that cost you nothing — full disclosure.