介绍
在支付事件发生时,自动将您的付费客户同步到 MailerLite 订阅者列表。将客户添加到特定组,触发自动化工作流,并使用真实的支付数据保持您的电子邮件营销列表的最新状态。 MailerLite 是一个强大的电子邮件营销平台,适用于新闻通讯、活动和自动化。此集成帮助您根据支付活动自动管理订阅者 - 非常适合入职序列、客户细分和有针对性的营销活动。此集成需要您的 MailerLite API 密钥用于认证。您可以在MailerLite 集成页面生成密钥。
开始使用
转换代码示例
在成功支付时添加客户
add_customer.js
根据产品将订阅者添加到多个组
product_segmentation.js
在订阅激活时添加新订阅者
subscription_subscriber.js
在订阅取消时更新订阅者
subscription_cancelled.js
使用自定义字段添加客户
custom_fields.js
通过事件触发自动化
trigger_automation.js
提示
- 在使用自定义字段之前,请在 MailerLite 中创建它们
- 使用组根据产品、计划级别或购买行为对客户进行细分
- 在 MailerLite 中设置在字段更新时触发的自动化工作流
- 使用 upsert 行为(POST 到 /subscribers)以避免重复订阅者错误
- 在自定义字段中存储支付元数据以获得更好的客户洞察
- 在为所有支付启用之前,先对小组进行测试
自定义字段设置
在使用自定义字段之前,您需要在 MailerLite 中创建它们:- 转到您的 MailerLite 仪表板
- 转到 Subscribers Fields
- 点击 Create field 并添加如下字段:
total_spent(数字)customer_since(日期)subscription_plan(文本)payment_method(文本)last_payment_amount(数字)
故障排除
Subscribers not being added
Subscribers not being added
- 验证 API 密钥是否正确且处于激活状态
- 检查电子邮件地址是否有效(符合 RFC 2821)
- 确保组 ID 正确且在您的帐户中存在
- 注意:已取消订阅、弹回或被标记为垃圾邮件的订阅者无法通过 API 重新激活
Custom fields not updating
Custom fields not updating
- 在使用自定义字段前请先确保它们在 MailerLite 中已存在
- 检查字段名称完全匹配(区分大小写)
- 确保字段值匹配预期类型(文本、数字、日期)
Rate limit errors
Rate limit errors
- MailerLite API 的速率限制为每分钟 120 次请求
- 如果处理大量订阅者,请使用批量端点
- 在高并发场景中实施退避策略
Group assignment not working
Group assignment not working
- 验证组 ID 是数字字符串
- 检查这些组是否存在于您的 MailerLite 帐户中
- 注意:使用 PUT 更新组将把订阅者从未列出的组中移除
API 参考
MailerLite 订阅者 API 接受以下关键参数:| 参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
email | string | 是 | 有效电子邮件地址(RFC 2821) |
fields | object | 否 | 包含字段名/字段值对的对象 |
fields.name | string | 否 | 订阅者的名字 |
fields.last_name | string | 否 | 订阅者的姓氏 |
fields.company | string | 否 | 公司名称 |
fields.country | string | 否 | 国家/地区 |
fields.city | string | 否 | 城市 |
fields.phone | string | 否 | 电话号码 |
groups | array | 否 | 要添加订阅者的组 ID 数组 |
status | string | 否 | 可选值之一:active、unsubscribed、unconfirmed、bounced、junk |
subscribed_at | string | 否 | 以 yyyy-MM-dd HH:mm:ss 格式表示的日期 |
ip_address | string | 否 | 订阅者的 IP 地址 |
