What the customer writes
import { Client } from "@shablon-eu/client" ; const client = new Client ({ apiKey: "sk_…" , environment: "production" , }); const { id, status } = await client. send ({ to: "ada@example.com" , template: "welcome" , parameters: { name: "Ada" , locale: "de" }, idempotencyKey: "signup-4821" , }); const { opened } = await client. status (id); The API of @shablon-eu/client , as published. Pick a layer to see the line it belongs to.
What has to hold underneath
01 Environments throws EnvironmentErrorDevelopment, staging and production are kept apart. In an environment that doesn’t send, the call is answered with “sandbox” and no real inbox is reached. 02 Addresses throws AddressErrorSender and every recipient in to, cc and bcc are validated. A bad address comes back as an error you can catch. 03 Templates and versions throws TemplateErrorTemplates are versioned and every version is kept. Each one can be previewed across devices and mail clients before it goes out. 04 Parameters and rules throws InvalidParametersMissing or malformed parameters are refused. Rules of any complexity pick the right variant by language or any other parameter. 05 Deduplication throws IdempotentErrorA retry must not become a second email in someone’s inbox. A key that was already used with different data is refused. 06 Delivery returns queued → sent · rejected · returnedThe email is queued and handed over for delivery. Whatever happens to it afterwards is recorded against its id. 07 Monitoring returns status(id) → openedWhat was sent, to whom and with what outcome stays inspectable in full logs, including whether the email was opened. And in the other direction: inbound email is delivered to your application as a webhook.