Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsMay 11, 2026·4 min de lecture

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.

Resend
Resend · Community
Prêt pour agents

Cet actif peut être lu et installé directement par les agents

TokRepo expose une commande CLI universelle, un contrat d'installation, le metadata JSON, un plan selon l'adaptateur et le contenu raw pour aider les agents à juger l'adaptation, le risque et les prochaines actions.

Stage only · 17/100Stage only
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Stage only
Confiance
Confiance : New
Point d'entrée
Asset
Commande CLI universelle
npx tokrepo install d826f667-d0f9-4ded-895e-19ed5d774b47
Introduction

Resend Audiences is the list-management API — your agent adds recipients on signup, removes them on unsubscribe, segments by tag, and ships compliant unsubscribe links automatically. No separate ESP, no list-import CSV nightmare. Best for: AI agents that nurture leads, newsletter signup flows, onboarding sequences with per-stage list membership, anywhere your agent needs to send to a managed group. Works with: Resend Node + Python SDKs, REST. Setup time: 5 minutes.


Create an audience

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

audience = client.audiences.create({"name": "TokRepo Weekly Digest"})
print(audience["id"])   # save this — used for all member ops

Add a contact

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

Bulk import on signup

async def on_user_signup(user):
    client.contacts.create({
        "audience_id": WEEKLY_DIGEST_ID,
        "email": user.email,
        "first_name": user.first_name,
        "unsubscribed": False,
    })
    # If user opted into multiple lists, repeat per audience_id

Send a broadcast to an audience

broadcast = client.broadcasts.create({
    "audience_id": WEEKLY_DIGEST_ID,
    "from": "TokRepo Weekly <weekly@tokrepo.com>",
    "subject": "5 new AI assets shipped this week",
    "html": render_weekly_digest_html(this_week_assets),
    "scheduled_at": "in 1 hour",   # or "2026-05-12 09:00:00 -0700"
})
client.broadcasts.send(broadcast["id"])

Compliance: unsubscribe + RFC 8058

Resend automatically:

  • Adds a one-click unsubscribe link to every broadcast email
  • Includes List-Unsubscribe and List-Unsubscribe-Post headers (Gmail/Yahoo 2024 sender requirements)
  • Records unsubscribes against the contact — future sends skip them
# Manually unsubscribe (e.g., from a user-facing preference center)
client.contacts.update({
    "audience_id": WEEKLY_DIGEST_ID,
    "email": "jane@example.com",
    "unsubscribed": True,
})

List members

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

FAQ

Q: Can I do tag-based segmentation? A: Yes — contacts support arbitrary tag fields. Filter at send time by tag value to create dynamic segments. Use a separate audience per major list type, then tags for sub-segmentation.

Q: How does Audiences compare to Klaviyo / Mailchimp? A: Audiences is a primitive — list + send + unsubscribe + compliance. Klaviyo/Mailchimp layer on visual campaign builders, automations, predictive segments. For AI-agent-driven lists where the agent IS the segmentation engine, Audiences is the right size.

Q: What about double opt-in? A: Not built in — Resend assumes you've collected consent before adding. Implement double opt-in by sending a confirm-email through emails.send with a token URL, and only call contacts.create after the recipient clicks confirm.


Quick Use

  1. client.audiences.create({name}) to make a list
  2. client.contacts.create({audience_id, email, ...}) per signup
  3. client.broadcasts.create + send to ship a campaign with auto-unsubscribe

Intro

Resend Audiences is the list-management API — your agent adds recipients on signup, removes them on unsubscribe, segments by tag, and ships compliant unsubscribe links automatically. No separate ESP, no list-import CSV nightmare. Best for: AI agents that nurture leads, newsletter signup flows, onboarding sequences with per-stage list membership, anywhere your agent needs to send to a managed group. Works with: Resend Node + Python SDKs, REST. Setup time: 5 minutes.


Create an audience

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

audience = client.audiences.create({"name": "TokRepo Weekly Digest"})
print(audience["id"])   # save this — used for all member ops

Add a contact

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

Bulk import on signup

async def on_user_signup(user):
    client.contacts.create({
        "audience_id": WEEKLY_DIGEST_ID,
        "email": user.email,
        "first_name": user.first_name,
        "unsubscribed": False,
    })
    # If user opted into multiple lists, repeat per audience_id

Send a broadcast to an audience

broadcast = client.broadcasts.create({
    "audience_id": WEEKLY_DIGEST_ID,
    "from": "TokRepo Weekly <weekly@tokrepo.com>",
    "subject": "5 new AI assets shipped this week",
    "html": render_weekly_digest_html(this_week_assets),
    "scheduled_at": "in 1 hour",   # or "2026-05-12 09:00:00 -0700"
})
client.broadcasts.send(broadcast["id"])

Compliance: unsubscribe + RFC 8058

Resend automatically:

  • Adds a one-click unsubscribe link to every broadcast email
  • Includes List-Unsubscribe and List-Unsubscribe-Post headers (Gmail/Yahoo 2024 sender requirements)
  • Records unsubscribes against the contact — future sends skip them
# Manually unsubscribe (e.g., from a user-facing preference center)
client.contacts.update({
    "audience_id": WEEKLY_DIGEST_ID,
    "email": "jane@example.com",
    "unsubscribed": True,
})

List members

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

FAQ

Q: Can I do tag-based segmentation? A: Yes — contacts support arbitrary tag fields. Filter at send time by tag value to create dynamic segments. Use a separate audience per major list type, then tags for sub-segmentation.

Q: How does Audiences compare to Klaviyo / Mailchimp? A: Audiences is a primitive — list + send + unsubscribe + compliance. Klaviyo/Mailchimp layer on visual campaign builders, automations, predictive segments. For AI-agent-driven lists where the agent IS the segmentation engine, Audiences is the right size.

Q: What about double opt-in? A: Not built in — Resend assumes you've collected consent before adding. Implement double opt-in by sending a confirm-email through emails.send with a token URL, and only call contacts.create after the recipient clicks confirm.


Source & Thanks

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

resend/resend-node — official SDK

🙏

Source et remerciements

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

resend/resend-node — official SDK

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires