Docs · Plantillas
Plantillas con variables.
Define subject, text y html una vez; en el envío pasas template_id y un mapa de variables. Solo sustitución de strings — sin lógica ni loops.
- 01sintaxis
Placeholders {{nombre}}
Los placeholders son {{identificador}} con espacios opcionales. El identificador acepta letras, dígitos, _, . y -.
{{nombre}}{{order.id}}sin loopsNo hay escape HTML automático de las variables: controla el contenido que inyectas.
- 02POST /v1/templates
Crear la plantilla
name, subject y opcionalmente text/html. mailack extrae la lista de variables del contenido.
POST /v1/templates curl -s -X POST "$MAILACK_API_URL/v1/templates" \ -H "Authorization: Bearer $MAILACK_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "bienvenida", "subject": "Hola {{nombre}}", "text": "Bienvenido, {{nombre}}.", "html": "<p>Bienvenido, <strong>{{nombre}}</strong>.</p>" }' | jq . - 03POST /v1/messages
Enviar con template_id
En lugar de subject/text/html, envía template_id y variables. Sigue siendo obligatorio Idempotency-Key y un From autorizado.
template_not_foundtemplate_render_errorPOST /v1/messages + template_id curl -s -X POST "$MAILACK_API_URL/v1/messages" \ -H "Authorization: Bearer $MAILACK_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d '{ "from": "hola@acme.mx", "to": "cliente@ejemplo.com", "template_id": "'"$TEMPLATE_ID"'", "variables": { "nombre": "Ada" } }' | jq . - 04portal y scopes
Dónde gestionarlo
CRUD también en el portal. Machine API: messages:send para mutaciones, evidence:read para listar. Rutas: /v1/templates y /v1/templates/{id}.