Skip to content
Docs · Webhooks

Lifecycle webhooks.

Receive HTTPS notifications when a message is queued, sent, deferred, bounced, complained about or sealed. Delivery is best-effort and never blocks the evidence chain.

  1. 01events

    Event types

    Subscribe to specific events or * (all). Every delivery is a JSON POST to your URL.

    email.queuedemail.sentemail.deferredemail.bouncedemail.complainedemail.sealed*
  2. 02POST /v1/webhooks

    Create the endpoint

    The response includes secret exactly once. Store it outside mailack — you use it to verify Mailack-Signature. The portal uses the same flow.

    POST /v1/webhooks
    curl -s -X POST "$MAILACK_API_URL/v1/webhooks" \
      -H "Authorization: Bearer $MAILACK_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "url": "https://api.suempresa.mx/hooks/mailack",
        "events": ["email.queued","email.sent","email.bounced","email.sealed"],
        "description": "ERP"
      }' | jq .
    
    # Guarda "secret" de la respuesta: solo se muestra una vez.
  3. 03signature

    Mailack-Signature

    Each POST carries Mailack-Event, Mailack-Signature (sha256=<hex> HMAC-SHA256 of the raw body) and Mailack-Webhook-Id. Respond 2xx to mark success.

    Content-Typeapplication/json
    Mailack-Eventemail.sent
    Mailack-Signaturesha256=<hmac-hex>
    User-Agentmailack-webhooks/1.0
    HMAC verification
    # Node.js — verificar Mailack-Signature
    const crypto = require("crypto");
    
    function verify(secret, rawBody, signatureHeader) {
      const expected = "sha256=" + crypto
        .createHmac("sha256", secret)
        .update(rawBody)
        .digest("hex");
      return crypto.timingSafeEqual(
        Buffer.from(expected),
        Buffer.from(signatureHeader || "")
      );
    }
  4. 04payload

    Event body

    Fixed shape: type, created_at (RFC 3339) and data (map with message_id and event metadata). Do not rely on undocumented fields.

    typeemail.sent
    created_at2026-08-06T12:00:00Z
    data.message_idmessage uuid
  5. 05ping

    Test the endpoint

    POST /v1/webhooks/{id}/ping (or the portal Test button) sends a synthetic event so you can validate URL and signature without waiting for real traffic.

    Delivery is async and best-effort: a failure on your side does not roll back send or NOM-151 sealing.

Next: templates

Reuse subject and body with variables on every send.