메인 콘텐츠로 건너뛰기

소개

결제 이벤트가 발생할 때 유료 고객을 MailerLite 구독자 목록에 자동으로 동기화합니다. 고객을 특정 그룹에 추가하고, 자동화 워크플로를 트리거하며, 실제 결제 데이터를 기반으로 이메일 마케팅 목록을 최신 상태로 유지합니다. MailerLite는 뉴스레터, 캠페인 및 자동화를 위한 강력한 이메일 마케팅 플랫폼입니다. 이 통합은 결제 활동에 따라 구독자를 자동으로 관리하는 데 도움을 줍니다 - 온보딩 시퀀스, 고객 세분화 및 타겟 마케팅 캠페인에 적합합니다.
이 통합은 인증을 위해 MailerLite API 키가 필요합니다. MailerLite 통합 페이지에서 생성할 수 있습니다.

시작하기

1

웹훅 섹션 열기

Dodo Payments 대시보드에서 Webhooks + Add Endpoint로 이동하고 통합 드롭다운을 확장합니다.
Add Endpoint and integrations dropdown
2

MailerLite 선택

MailerLite 통합 카드를 선택합니다.
3

API 키 입력

구성에서 MailerLite API 키를 제공합니다.
4

변환 구성

MailerLite의 API에 맞게 구독자 데이터를 형식화하는 변환 코드를 편집합니다.
5

테스트 및 생성

샘플 페이로드로 테스트하고 Create를 클릭하여 구독자 동기화를 활성화합니다.
6

완료!

이제 결제 이벤트가 고객을 자동으로 MailerLite 목록에 동기화합니다.

변환 코드 예제

성공적인 결제 시 고객 추가

add_customer.js
function handler(webhook) {
  if (webhook.eventType === "payment.succeeded") {
    const p = webhook.payload.data;
    webhook.url = "https://connect.mailerlite.com/api/subscribers";
    webhook.payload = {
      email: p.customer.email,
      fields: {
        name: p.customer.name,
        company: p.customer.business_name || "",
        last_name: ""
      },
      groups: ["your-group-id-here"],
      status: "active"
    };
  }
  return webhook;
}

제품에 따라 여러 그룹에 구독자 추가

product_segmentation.js
function handler(webhook) {
  if (webhook.eventType === "payment.succeeded") {
    const p = webhook.payload.data;
    
    // Determine groups based on product or amount
    const groups = ["customers-group-id"];
    
    // Add to premium group if high-value purchase
    if (p.total_amount >= 10000) { // $100+
      groups.push("premium-customers-group-id");
    }
    
    webhook.url = "https://connect.mailerlite.com/api/subscribers";
    webhook.payload = {
      email: p.customer.email,
      fields: {
        name: p.customer.name,
        last_purchase_amount: (p.total_amount / 100).toFixed(2),
        last_purchase_date: new Date(webhook.payload.timestamp).toISOString().split('T')[0],
        payment_id: p.payment_id
      },
      groups: groups,
      status: "active"
    };
  }
  return webhook;
}

구독 활성화 시 새로운 구독자 추가

subscription_subscriber.js
function handler(webhook) {
  if (webhook.eventType === "subscription.active") {
    const s = webhook.payload.data;
    webhook.url = "https://connect.mailerlite.com/api/subscribers";
    webhook.payload = {
      email: s.customer.email,
      fields: {
        name: s.customer.name,
        subscription_plan: s.product_id,
        subscription_amount: (s.recurring_pre_tax_amount / 100).toFixed(2),
        billing_frequency: s.payment_frequency_interval,
        subscription_start: new Date().toISOString().split('T')[0]
      },
      groups: ["subscribers-group-id", "active-subscriptions-group-id"],
      status: "active"
    };
  }
  return webhook;
}

구독 취소 시 구독자 업데이트

subscription_cancelled.js
function handler(webhook) {
  if (webhook.eventType === "subscription.cancelled") {
    const s = webhook.payload.data;
    // Use PUT to update existing subscriber
    webhook.url = "https://connect.mailerlite.com/api/subscribers/" + encodeURIComponent(s.customer.email);
    webhook.method = "PUT";
    webhook.payload = {
      fields: {
        subscription_status: "cancelled",
        cancellation_date: new Date().toISOString().split('T')[0]
      },
      groups: ["churned-customers-group-id"]
    };
  }
  return webhook;
}

사용자 정의 필드로 고객 추가

custom_fields.js
function handler(webhook) {
  if (webhook.eventType === "payment.succeeded") {
    const p = webhook.payload.data;
    webhook.url = "https://connect.mailerlite.com/api/subscribers";
    webhook.payload = {
      email: p.customer.email,
      fields: {
        name: p.customer.name,
        company: p.customer.business_name || "",
        country: p.customer.country || "",
        city: p.customer.city || "",
        phone: p.customer.phone || "",
        // Custom fields (must be created in MailerLite first)
        total_spent: (p.total_amount / 100).toFixed(2),
        customer_since: new Date().toISOString().split('T')[0],
        payment_method: p.payment_method || "unknown",
        currency: p.currency || "USD"
      },
      groups: ["paying-customers-group-id"],
      status: "active",
      subscribed_at: new Date().toISOString().replace('T', ' ').split('.')[0]
    };
  }
  return webhook;
}

이벤트를 통한 자동화 트리거

trigger_automation.js
function handler(webhook) {
  if (webhook.eventType === "payment.succeeded") {
    const p = webhook.payload.data;
    
    // First, ensure subscriber exists
    webhook.url = "https://connect.mailerlite.com/api/subscribers";
    webhook.payload = {
      email: p.customer.email,
      fields: {
        name: p.customer.name,
        // Add a trigger field that your automation watches
        last_payment_trigger: new Date().toISOString(),
        last_payment_amount: (p.total_amount / 100).toFixed(2)
      },
      status: "active"
    };
    
    // Tip: Create an automation in MailerLite that triggers
    // when 'last_payment_trigger' field is updated
  }
  return webhook;
}

  • 변환에서 사용하기 전에 MailerLite에서 사용자 정의 필드를 생성하세요.
  • 그룹을 사용하여 제품, 요금제 또는 구매 행동에 따라 고객을 세분화하세요.
  • MailerLite에서 필드 업데이트에 따라 트리거되는 자동화 워크플로를 설정하세요.
  • 중복 구독자 오류를 피하기 위해 upsert 동작(POST to /subscribers)을 사용하세요.
  • 더 나은 고객 통찰력을 위해 결제 메타데이터를 사용자 정의 필드에 저장하세요.
  • 모든 결제에 대해 활성화하기 전에 소규모 그룹으로 테스트하세요.

사용자 정의 필드 설정

사용자 정의 필드를 사용하기 전에 MailerLite에서 생성해야 합니다:
  1. MailerLite 대시보드로 이동합니다.
  2. 구독자 필드로 이동합니다.
  3. 필드 생성을 클릭하고 다음과 같은 필드를 추가합니다:
    • total_spent (숫자)
    • customer_since (날짜)
    • subscription_plan (텍스트)
    • payment_method (텍스트)
    • last_payment_amount (숫자)

문제 해결

  • API 키가 올바르고 활성 상태인지 확인하세요.
  • 이메일 주소가 유효한지 확인하세요 (RFC 2821 준수).
  • 그룹 ID가 올바르고 계정에 존재하는지 확인하세요.
  • 참고: 구독 해지, 반송 또는 스팸 구독자는 API를 통해 재활성화할 수 없습니다.
  • 사용하기 전에 MailerLite에 사용자 정의 필드가 존재하는지 확인하세요.
  • 필드 이름이 정확히 일치하는지 확인하세요 (대소문자 구분).
  • 필드 값이 예상 유형(텍스트, 숫자, 날짜)과 일치하는지 확인하세요.
  • MailerLite API는 분당 120개의 요청 제한이 있습니다.
  • 많은 구독자를 처리할 경우 배치 엔드포인트를 사용하세요.
  • 대량 시나리오에 대해 백오프 전략을 구현하세요.
  • 그룹 ID가 숫자 문자열인지 확인하세요.
  • MailerLite 계정에 그룹이 존재하는지 확인하세요.
  • 참고: 그룹과 함께 PUT을 사용하면 구독자가 나열되지 않은 그룹에서 제거됩니다.

API 참조

MailerLite 구독자 API는 다음 주요 매개변수를 수락합니다:
매개변수유형필수설명
emailstring유효한 이메일 주소 (RFC 2821)
fieldsobject아니요필드 이름/값 쌍이 포함된 객체
fields.namestring아니요구독자의 이름
fields.last_namestring아니요구독자의 성
fields.companystring아니요회사 이름
fields.countrystring아니요국가
fields.citystring아니요도시
fields.phonestring아니요전화번호
groupsarray아니요구독자를 추가할 그룹 ID 배열
statusstring아니요다음 중 하나: active, unsubscribed, unconfirmed, bounced, junk
subscribed_atstring아니요형식 yyyy-MM-dd HH:mm:ss의 날짜
ip_addressstring아니요구독자의 IP 주소
완전한 API 문서는 MailerLite Developers를 방문하세요.