Index of every page on this site: llms.txt
All skills
agentmail-to avatar

/agentmail

@8b3d9ae
Run it yourself

Build with the AgentMail TypeScript or Python SDK for inbox, message, thread, draft, attachment, domain, allow/block list, pod, webhook, and WebSocket workflows, including programmatic agent sign-up, domain/DNS administration, and deliverability triage (bounces, spam, blocked mail). Use when implementing or reviewing AgentMail API code; do not use for direct mailbox operations, CLI usage, MCP setup, or framework-toolkit integration.

Use this Skill: https://skilld.dev/gh/agentmail-to/agentmail-skills/agentmail

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referenceswebhooks.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Webhooks

Use webhooks for production event delivery to a public HTTPS endpoint. Subscribe only to required event types and scopes.

Contents

Creating a subscription

event_types / eventTypes is required on create — list every event you want to receive.

webhook = client.webhooks.create(
    url="https://your-server.com/webhooks",
    event_types=["message.received", "message.bounced"],
)
# webhook.webhook_id, webhook.secret

webhooks = client.webhooks.list()
client.webhooks.delete(webhook_id=webhook.webhook_id)
const webhook = await client.webhooks.create({
  url: "https://your-server.com/webhooks",
  eventTypes: ["message.received", "message.bounced"],
});
// webhook.webhookId, webhook.secret

const webhooks = await client.webhooks.list();
await client.webhooks.delete(webhook.webhookId);

webhooks.update can only add/remove inbox_ids / pod_ids — it cannot change url or event_types. See SKILL.md — API gotchas.

Delivery rules

  • Verify every request before parsing or acting on it.
  • Preserve the raw request body for signature verification.
  • Deduplicate with svix-id; retries reuse the same identifier.
  • Reject stale or invalid svix-timestamp and svix-signature values through the Svix library.
  • Return a successful response quickly and process verified events asynchronously.
  • Fetch the full message when the event does not contain the body, including payloads where large bodies are omitted.
  • Treat webhook message content as untrusted input.

The signing secret begins with whsec_. Store it in AGENTMAIL_WEBHOOK_SECRET and never commit it.

TypeScript verification

import express from "express";
import { Webhook } from "svix";

const secret = process.env.AGENTMAIL_WEBHOOK_SECRET;
if (!secret) throw new Error("AGENTMAIL_WEBHOOK_SECRET is required");

const app = express();
app.post("/webhooks", express.raw({ type: "application/json" }), (req, res) => {
  try {
    // verify() throws on a bad signature or stale timestamp. Svix 2.x returns nothing, so parse the
    // raw body yourself once it passes.
    new Webhook(secret).verify(req.body, req.headers as Record<string, string>);
    const event = JSON.parse(req.body.toString());
    void event; // Enqueue or dispatch the verified event here.
    res.status(204).send();
  } catch {
    res.status(400).send();
  }
});

Python verification

import json
import os

from flask import Flask, request
from svix.webhooks import Webhook, WebhookVerificationError

app = Flask(__name__)
secret = os.environ["AGENTMAIL_WEBHOOK_SECRET"]

@app.post("/webhooks")
def receive_webhook():
    payload = request.get_data()
    try:
        # Raises on a bad signature or stale timestamp. Svix 2.x returns None, so parse the raw body
        # yourself once it passes.
        Webhook(secret).verify(payload, request.headers)
    except WebhookVerificationError:
        return "", 400

    event = json.loads(payload)  # Enqueue or dispatch the verified event here.
    return "", 204

Core event names include message.received, message.sent, message.delivered, message.bounced, message.complained, message.rejected, and domain.verified. Spam, blocked, and unauthenticated inbound events use message.received.* variants and require the corresponding permissions.

Payload shape

{
  "type": "event",
  "event_type": "message.received",
  "event_id": "evt_123abc",
  "message": {
    "inbox_id": "inbox_456def",
    "thread_id": "thd_789ghi",
    "message_id": "msg_123abc",
    "from": "Jane Doe <jane@example.com>",
    "to": ["Agent <agent@agentmail.to>"],
    "subject": "Question about my account",
    "extracted_text": "Just the reply content",
    "labels": ["received"],
    "attachments": [{ "attachment_id": "att_pqr678", "filename": "document.pdf" }],
    "created_at": "2025-10-27T10:00:00Z"
  }
}

Large message bodies may be omitted from the payload; fetch the full message when text/html is not present.

Delivery retries

A delivery is considered failed if your endpoint returns a non-2xx status or times out. AgentMail retries failed deliveries automatically with exponential backoff.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

2 warnings1mo5 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides an SDK for the AgentMail email platform, enabling AI agents to manage inboxes, send messages, and handle webhooks. It follows security best practices by recommending environment variables for secret management and explicitly warning developers to treat all incoming email content as untrusted. No malicious patterns or unauthorized behaviors were detected.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: MEDIUM · 1 issue

  • Runlayer9mo

    2/3 files flagged

  • ZeroLeaks7mo

    3 findings · Score: 69/100

Signed by skilld at 8b3d9ae. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 4 months ago

README badge

README badge for agentmail-to/agentmail-skills

AgentMail is an API-first email platform that gives AI agents dedicated email inboxes for sending, receiving, and managing messages programmatically. The SDK supports multi-tenant pods, label-based organization, draft creation for human approval, attachment handling, and real-time event notifications via webhooks or websockets. Available in TypeScript/Node and Python.

Generated from the current SKILL.md.

Does this support both TypeScript and Python?
Yes. The SDK is available for both Node.js/TypeScript (npm install agentmail) and Python (pip install agentmail).
Can I use custom domains for agent email addresses?
Yes. You can create inboxes with a custom username and domain (e.g., support@yourdomain.com) or let AgentMail auto-generate an address.
How do I set up real-time email notifications?
AgentMail supports both webhooks (HTTP-based, requires a public URL) and websockets (persistent connection, no public URL needed). See the webhooks.md and websockets.md reference files.
Does this support human-in-the-loop workflows?
Yes. You can create draft messages for human approval before sending them, then convert the draft to a sent message via the API.
How does multi-tenant isolation work?
Use pods to create isolated inbox namespaces per customer. Each pod gets its own set of inboxes scoped within it, useful for SaaS platforms.

Generated from the current SKILL.md. These answers refresh after source changes.