Templates
Emails, PDFs, wallet passes, the app, the website, checkout styling, thermal slips, and seating-map drawings are trees of nodes. Each template has a type string (from getTemplateSchema) and a working copy — the draft tree. Changes stay in that working copy until someone publishes in Loby Cloud. Guests keep seeing the last published version.
Workflow
listMuseums— get the museum id (match by name). Do not guess ids.listTemplates— every template of that museum. Optionally filter bytype.getGuide— start withtemplating, then a kind guide (email-templates,print-templates, and so on).getTemplateSchema— what that kind can hold: its node types with their props and styles, its options, the values it is drawn from, and what a condition can test. Nothing else is accepted on that kind.getTemplate— read the working copy before you change anything. Every node has an id; a change names the node by that id.- Edit with
insertTemplateNodes(batch),updateTemplateNode,removeTemplateNode,moveTemplateNode,setTemplateOption. - Publish in the product. MCP does not publish.
getTemplateAssignments shows which default emails, PDFs, passes, thermal slips, and checkout styling the museum uses. It does not change them.
Every change is checked
A change is checked before anything is saved: against the template as it is now, and against what its kind can hold. The check runs in the Loby API itself, so it is the same for an MCP client, the back office assistant, the designer in Loby Cloud and a direct API call. A call saves all of what it was given or none of it, so a template is never left half changed.
When a change does not fit, the tool answers Not saved, then one line per problem: which part of what you sent, what is wrong, and what would be right.
Not saved: 3 problems. Nothing was changed; correct them and send the change again. 1. props.content: TEXT has no prop "content" on this kind of template (Order receipt PDF). Its props: text, dateFormat. 2. styles.color: "color" is not a style of TEXT on this kind of template (Order receipt PDF). Here that is fontColor. Its styles: … 3. styles.fontSize: expected a number without a unit (13, not "13px"); got the text "14px".
Correct those parts and send the whole change again. What is turned down most often:
- A style under its name from the web. A text colour is
fontColor, a background isfill, and spacing is set per side (paddingTop,marginLeft). - A number with a unit. A size is
13, not"13px". - A node of a type the kind cannot draw. A PDF holds what a page can show, not what the app can.
- A node id that is not in the working copy. Read the template again.
- A node inside one that cannot hold nodes. Only groups such as
LAYER,CONDITIONandITERATORhold other nodes. - A condition that is not complete, or uses an operator its kind does not evaluate (
getTemplateSchemalists them underconditions).
A tool that changes a template answers with what it changed as it is now saved (the node, the inserted nodes with their ids, the options), not with the whole template.
Receipts
A museum has two receipts, and they are two templates. The receipt PDF (type ORDER_RECEIPT) is the A4 page behind Download receipt on a transaction in Loby Cloud and behind the link in the receipt email; getGuide print-templates describes it. The printed receipt (type POS_RECEIPT) is what a cash register prints on its receipt printer; getGuide thermal-templates describes it. getTemplateAssignments shows which one of each the museum uses.
Nodes
Open getTemplateSchema so you use allowed types and props. Insert many nodes in one insertTemplateNodes call. Groups (for example LAYER) may include children. TEXT may include text and language.
updateTemplateNode only changes the fields you pass: props, styles, elementStyles, text, language, name, hide. Pass null on a prop or style key to clear it.
A TEXT holds one text per language. text changes one language (language, or the museum's default language when left out); the others keep their text, so a new wording has to be written in each language the text has.
moveTemplateNode placement is INSIDE, ABOVE, or BELOW.
setTemplateOption changes template-level options (subject, background color, pass images, content roots, default styles, app intro). Path names come from getTemplateSchema. For an email subject, pass language too.
Content, fonts, photos
Templates can bind CONTENT nodes and content roots to content models and items (listContentModels, listContentItems). TEXT styles can use uploaded fonts (listFonts). IMAGE nodes and pass options store a photo id; look up a known id with getPhoto (there is no museum-wide photo list).
See Templates, Content, fonts, photos, and Guides.