Skip to Content
Xeonr Developer Docs
API SpecificationTemplates

Preview template

POST
/xeonr.notify.v1.TemplateService/PreviewTemplate

Renders a template against a payload without publishing or sending anything — the console's live preview, and the way to see the email exactly as it will arrive. Pass the bodies inline to preview the editor's current contents, or omit them to render whatever is stored, draft first. An empty payload falls back to each variable's declared example, which is what makes a preview work before anybody has invented one. A kind with no template at all previews as empty rather than failing. Parse errors and missing required variables come back in error; variables the bodies reference but do not declare come back in undeclared, which is not an error but is usually a typo. Needs admin of the team that owns the app, or notify:platform:admin.

Required scopes: notify:templates:read

Authorization

BearerAuth
AuthorizationBearer <token>

An access token from Xeonr Auth, presented as Authorization: Bearer <token>. Its audience must include https://notify.xeonr.io, and it must carry the scope the method lists.

In: header

Header Parameters

Connect-Protocol-Version*number

Define the version of the Connect protocol

Value in1
Connect-Timeout-Ms?number

Define the timeout, in ms

Request Body

application/json

appSlug?string
Length1 <= length <= 64
kind?string
Length1 <= length <= 64
defaultBody?

Render this instead of the stored draft. The console sends the editor's current contents, so the preview tracks typing rather than the last save.

channelBodies?array<>
Itemsitems <= 8
variables?array<>
Itemsitems <= 64
payload?

The values to render with. Empty uses each variable's declared example, which is what makes a preview work before anybody has invented a payload. validate:skip free-form render values; the version's declared variables are what bound them

[key: string]?never

Response Body

application/json

application/json

curl -X POST "https://notify.xeonr.io/xeonr.notify.v1.TemplateService/PreviewTemplate" \  -H "Connect-Protocol-Version: 1" \  -H "Content-Type: application/json" \  -d '{}'
{
  "renders": [
    "map[body:Luke approved your request for Dune: Part Two. channel:CHANNEL_EMAIL html:<p>Luke approved your request for <b>Dune: Part Two</b>.</p> subject:[XMB] Dune: Part Two was approved title:Dune: Part Two was approved]"
  ],
  "error": "template: missing required variable \"request_title\"",
  "undeclared": [
    "requester"
  ]
}