What one request holds
| Field | What it holds |
|---|---|
| channel | email, the one channel built today. |
| templateId | The template to send. |
| to | A person you identified, by userId, or an address with no profile, by email. |
| from | An address on a verified sending domain of your workspace. |
| data | The merge data for the template. |
The send API page lists every field, with its answers.
Who it reaches
- It reaches a person who unsubscribed from marketing.
- It never reaches a suppressed address.
- It has no unsubscribe link.
A retry sends once
Send an Idempotency-Key with the request. A retry with the same key is the same message, and it is sent once.
Send it
HTTP
curl https://api.maqetin.com/v1/public/messages \
-H 'Authorization: Bearer mq_sec_…' \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: order-42:receipt' \
-d '{
"channel": "email",
"templateId": "tpl_receipt",
"to": { "email": "ada@example.com" },
"from": "Receipts <receipts@mail.harbourmoney.co.uk>",
"subject": "Your receipt",
"data": { "order": { "id": "o_42", "total": 12.5 } }
}'Node
import { MaqetinServer } from '@maqetin/sdk-js/server';
const mq = new MaqetinServer({ secretKey: process.env.MAQETIN_SECRET_KEY });
const { messageId } = await mq.messages.send({
channel: 'email',
templateId: 'tpl_receipt',
to: { userId: 'u_42' }, // or { email: 'guest@example.com' }
from: 'Harbour Money <receipts@mail.harbourmoney.co.uk>',
data: { order: { id: 'o_42', total: 12.5 } },
idempotencyKey: 'order-42:receipt',
});Keys and limits
The request needs a secret key with the messages:send scope. A key sends up to 300 messages a minute.
The server entry of the SDK refuses to run in a web page, so the key stays on your server.