Scripts2026年5月11日·1 分钟阅读

Resend Audiences — Manage Email Lists from AI Agents

Resend Audiences API lets agents add, remove, segment, unsubscribe email recipients. Tag-based segments. Compliant unsubscribe built in.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Stage only · 17/100Stage only
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Stage only
信任
信任等级:New
入口
Asset
通用 CLI 安装命令
npx tokrepo install d826f667-d0f9-4ded-895e-19ed5d774b47

简介

Resend Audiences 是列表管理 API —— agent 在注册时加收件人、退订时移除、按 tag 分群、自动带合规退订链接。不用单独 ESP、没 CSV 导入噩梦。适合培养 leads 的 AI agent、newsletter 注册流、按阶段成员管理的 onboarding 序列、任何 agent 需要发给托管群体的场景。兼容 Resend Node + Python SDK、REST。装机时间 5 分钟。


创建 audience

from resend import Resend
client = Resend(api_key=os.environ["RESEND_API_KEY"])

audience = client.audiences.create({"name": "TokRepo 周报"})
print(audience["id"])   # 存下来 —— 所有成员操作要用

加联系人

client.contacts.create({
    "audience_id": audience_id,
    "email": "jane@example.com",
    "first_name": "Jane",
    "last_name": "Smith",
    "unsubscribed": False,
})

注册时批量导入

async def on_user_signup(user):
    client.contacts.create({
        "audience_id": WEEKLY_DIGEST_ID,
        "email": user.email,
        "first_name": user.first_name,
        "unsubscribed": False,
    })
    # 用户订了多个列表就按 audience_id 重复

给 audience 群发

broadcast = client.broadcasts.create({
    "audience_id": WEEKLY_DIGEST_ID,
    "from": "TokRepo Weekly <weekly@tokrepo.com>",
    "subject": "本周上线 5 个 AI 新资产",
    "html": render_weekly_digest_html(this_week_assets),
    "scheduled_at": "in 1 hour",   # 或 "2026-05-12 09:00:00 -0700"
})
client.broadcasts.send(broadcast["id"])

合规:退订 + RFC 8058

Resend 自动:

  • 每封群发邮件加一键退订链接
  • List-UnsubscribeList-Unsubscribe-Post header(Gmail/Yahoo 2024 发件人要求)
  • 把退订记到联系人身上 —— 后续发送跳过
# 手动退订(例如用户首选项中心)
client.contacts.update({
    "audience_id": WEEKLY_DIGEST_ID,
    "email": "jane@example.com",
    "unsubscribed": True,
})

列成员

contacts = client.contacts.list({"audience_id": WEEKLY_DIGEST_ID})
for c in contacts["data"]:
    print(c["email"], c["unsubscribed"])

FAQ

Q: 能按 tag 分群吗? A: 能 —— 联系人支持任意 tag 字段。发送时按 tag 值过滤做动态分群。每个主要列表类型用独立 audience,再用 tag 做子分群。

Q: Audiences 跟 Klaviyo / Mailchimp 比? A: Audiences 是 primitive —— list + 发送 + 退订 + 合规。Klaviyo/Mailchimp 加可视化营销建造器、自动化、预测分群。AI agent 驱动列表(agent 本身就是分群引擎)用 Audiences 大小合适。

Q: 双重确认(double opt-in)呢? A: 没内置 —— Resend 假设你加之前已收到同意。通过 emails.send 发带 token URL 的确认邮件,收件人点确认后再调 contacts.create 实现双重确认。


🙏

来源与感谢

Built by Resend. Audiences API docs at resend.com/docs/api-reference/audiences.

resend/resend-node — official SDK

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产