Overview
KlokMail_v1 defines the contract for Klok's shared mail service. It describes three things: a mail received for an
account, a mail an account wants sent, and the outcome of a send request. The model is provider neutral. Postmark
formats live inside klok-postmark-ingress and klok-postmark-egress, not in the model, so a client never sees them. A
field a provider cannot express is ignored by that provider's egress.
The model is class A, public, owned by the Klok platform as part of solution KLK006 Messaging Services. The services
that publish and consume it, klok-postmark-ingress, klok-postmark-egress and klok-api-mail, are designed but not
built yet, so nothing publishes or consumes the model today. When they are, an ingress receives provider webhooks and
publishes inbound mail, a client publishes a send request, the egress sends it and answers with the result, and
klok-api-mail routes Klok AI's mail to mailboxes and writes Klok Svar's drafts.
Traffic is split across two namespaces. In klok/mail the account, the provider server the mail came in on or the
result belongs to, decides the purpose; the topic decides the account, never a field. In klok/mailbox, Klok AI's mail
routed by address to mailboxes by klok-api-mail, the purpose is the reader the mail belongs to. A routed mail carries
its mailbox and its threadId; a notice to a person's ordinary address carries neither.
What travels is one of three records: KlokMailInboundV1 (keyed by providerMessageId), KlokMailOutboundV1 and
KlokMailSendResultV1 (both keyed by sendKey), each on its own topic. A fourth record, KlokMailDraftV1, holds a
Klok Svar draft and a person's decision about it. The root KlokMail_v1 only ties the schema together; clients inspect
which child element is populated to tell the records apart.
Where this documentation comes from
This site is written by KlokDocumentationEgress from the project's code, its hand written klok-docs/ folder and the
tenant's documentation generation settings, on every main pipeline of klok/datamodel/public/klok-mail-v1. Nobody
edits it by hand.
| To change |
Edit |
| Hand written pages, their order, and where a generated section appears in them |
klok-docs/ in klok/datamodel/public/klok-mail-v1 |
| What is generated and how: chapters, sections, prompts, languages, model |
klok.dev, Tenant Administration, Documentation generation |