Email

List the project's email template mappings

  • Sandbox: available
  • Staging: available
  • Production: unknown
GET
/v1/projects/me/email-templates

Lists the email template mappings of your current project: for each Ovok template name, which template of your email provider it sends, in which language and for which domain. It also lists the template names the project has no mapping for.

Auth: bearer token. The caller must be a Practitioner, a project admin, or hold the System Owner access policy. Scope: the caller's project (from the token).

Behaviour

  • mappings holds the project's own mappings. Mappings of the parent project and of the platform are not listed.
  • unmapped holds the template names the project has no mapping for, in any language or domain. It does not say that nothing is sent: a parent project's or the platform's mapping may still apply, and an unmapped patient template (PATIENT_RESET_PASSWORD, PATIENT_ACCOUNT_DELETION, PATIENT_ORGANIZATION_CODES, PATIENT_INVITE) is sent as its shared template when the mapping maps that one.
  • A mapping applies to a mail in its language and for its domain. A null language or domain means the mapping names none. Sending tries the most specific context first: domain and language, domain and the project's default language, domain alone, language alone, the default language, then no context. Within one level it takes the project's mapping, then its parent's, then the platform's, so a parent's or the platform's mapping at a more specific level is used before the project's own at a less specific one.
  • ready is false when the project's secrets lack what the provider needs: its credential (BREVO_API_KEY, SENDGRID_API_KEY, RESEND_API_KEY or SMTP_URL), and EMAIL_FROM for SendGrid and SMTP. It only checks that they are there, not that they work. A mapping that is not ready cannot send; sending moves on to the next mapping that applies.
  • One language and domain use one provider. When a project has several ConceptMaps for the same language and domain, only the most recently updated one is read, as sending does.
  • Mappings are ordered as the template names are, then by language and domain. Their html is left out: GET /v1/projects/me/email-templates/:name returns it.

Example

curl -X GET 'https://api.sandbox.ovok.com/v1/projects/me/email-templates' \  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk'

Authorization

bearer
headerAuthorizationBearer <JWT>

Response Body

The project's own mappings, and the template names it has none for.

application/json
  1. response
projectId*string
mappings*array<>
unmapped*array<>

Template names this project has no mapping for, in any language or domain.

Example Request
curl -X GET 'https://api.sandbox.ovok.com/v1/projects/me/email-templates'
Example Response
{  "projectId": "string",  "mappings": [    {      "name": "OVOK_ORGANIZATION_CODES",      "provider": "brevo",      "templateId": "string",      "language": "string",      "domain": "string",      "subject": "string",      "ready": true    }  ],  "unmapped": [    "OVOK_ORGANIZATION_CODES"  ]}

List email templates and their params GET

Lists every email template a project can map in its email ConceptMap, with the params each one receives. Use it when you write or review a template. **Auth:** bearer token. The caller must be a Practitioner, an admin or a super admin, or hold the "System Owner" access policy. **Scope:** none. The list is the same for every project. ## Behaviour - Each entry has the template `name`, the `audience` (`patient` or `practitioner`), the `params`, a full `example`, and the `syntax` each provider uses to reference a param. - `audience` tells you whose app the `baseUrl` param points at: the patient app or the practitioner dashboard. - Every listed param is always sent. A param marked `nullable` is `null` when there is no value. - A send whose params do not match its template is refused, so a template can rely on every param listed. - Resend accepts text and numbers only. A list param `x` reaches Resend as `xList`, with one item per line, and a null reaches it as an empty string. - Entries follow the order of the `TemplateNames` enum. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/email/templates' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```

Get an email template mapping GET

Returns one email template mapping of your current project, with its HTML when it is an SMTP one. **Auth:** bearer token. The caller must be a Practitioner, a project admin, or hold the System Owner access policy. **Scope:** the caller's project (from the token). ## Behaviour - `:name` must be one of the template names. An unknown one returns 400 `UNKNOWN_TEMPLATE` with the accepted names. - `language` and `domain` choose which mapping of the template. Both are matched exactly, and leaving one out asks for the mapping that has none. `language` is one of Ovok's locale codes, such as `en-US` or `de-DE`; a bare `en` is read as `en-US`, and any other value returns 422. `domain` is a host name such as `app.example.com`, lower-cased, without scheme or port. - Only the project's own mappings are found. A template that is mapped in the parent project or the platform, but not here, returns 404. - `subject` and `html` are set for SMTP only. ## Example ```bash curl -X GET 'https://api.sandbox.ovok.com/v1/projects/me/email-templates/INVITE_TO_PROJECT?language=en-US' \ -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' ```