메인 콘텐츠로 건너뛰기

소개

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

시작하기

1

Open the Webhook Section

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

Select MailerLite

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

Enter API Key

구성에서 MailerLite API 키를 입력합니다.
4

Configure Transformation

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

Test & Create

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

Done!

결제 이벤트가 이제 자동으로 고객을 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. Subscribers Fields로 이동
  3. Create field를 클릭한 다음 다음과 같은 필드를 추가합니다:
    • 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는 다음 주요 매개변수를 수락합니다:
매개변수유형필수설명
emailstringYes유효한 이메일 주소(RFC 2821)
fieldsobjectNo필드 이름/값 쌍이 있는 객체
fields.namestringNo구독자의 이름
fields.last_namestringNo구독자의 성
fields.companystringNo회사 이름
fields.countrystringNo국가
fields.citystringNo도시
fields.phonestringNo전화번호
groupsarrayNo구독자를 추가할 그룹 ID 배열
statusstringNo다음 값 중 하나: active, unsubscribed, unconfirmed, bounced, junk
subscribed_atstringNo형식 yyyy-MM-dd HH:mm:ss의 날짜
ip_addressstringNo구독자의 IP 주소
완전한 API 문서는 MailerLite Developers를 방문하세요.