Card templates
Cards are structured content the assistant shows in the conversation. They appear live, are saved with the conversation and are shown again when the shopper comes back.
| Kind | Fields (limits) | Shown when |
|---|---|---|
buttons |
buttons 1–6, title ≤ 120 |
The assistant decides |
infoCard |
title ≤ 120, subtitle ≤ 160, body ≤ 1,200, fields ≤ 10 × {label ≤ 60, value ≤ 200}, imageUrl, buttons |
The assistant decides |
orderCard |
orderNumber, status, placedAt, total, currency, items ≤ 20 × {title, quantity, price, imageUrl}, trackingUrl, buttons |
The assistant decides, or a signed-in customer’s order |
productCard |
one product, buttons |
A product search |
productList |
products 1–12, layout grid or carousel, title ≤ 80, buttons |
A product search |
A product has id, externalId, title, url, imageUrl, price, salePrice, currency, availability, brand, category, description (≤ 200) and attributes (≤ 10). Every URL must be https (≤ 2,000 characters).
Product cards are always built from your catalog, so prices can never be invented.
Buttons
Section titled “Buttons”action |
Fields | What happens |
|---|---|---|
link |
label, url (https), target _blank or _self |
A normal link |
reply |
label, text? (≤ 500) |
Sends text (or the label) as the visitor’s message |
callback |
label, name, payload? (≤ 1 KB JSON), forwardTo? |
Fires an action event on the host page |
callback buttons come only from your own templates: the assistant cannot create them, so only you decide which page functions exist. See Host callbacks.
Your own templates
Section titled “Your own templates”Each kind can be redesigned in Appearance → Components (plans with custom card designs), with a live preview. A template holds up to 8,000 characters, its CSS up to 4,000.
The template language is a small, safe Mustache subset:
| Syntax | Meaning |
|---|---|
{{path.to.field}} |
HTML-escaped value. There is no raw output. |
{{#each list}} … {{else}} … {{/each}} |
Loop, with {{this}}, {{@index}}, {{@first}}, {{@last}} |
{{#if x}} … {{else}} … {{/if}}, {{#unless x}} |
Conditions. Empty arrays and '0' are false. |
{{../field}} |
The parent scope |
Output is capped at 64 KB and 200 loop iterations. Any error, or empty output, falls back to the built-in template, so a broken template never blanks the chat.
Prepared fields are added for convenience: priceFormatted, salePriceFormatted, hasSale, discountPercent, isInStock, availabilityLabel (in six languages), attributeList.
On save, templates are rejected when they contain containing <script>, <iframe>, <object>, <embed>, <form>, <style>, <link>, <meta>, <base>, <svg>, <math>, inline on…= handlers, javascript:, data:text/html or srcdoc (422).
The sanitizer
Section titled “The sanitizer”Every card is sanitised before it is shown:
- Allowed tags:
a b br button del div em figcaption figure h1–h4 hr i img li ol p s small span strong table tbody td th thead tr ul. - Allowed attributes:
alt aria-hidden aria-label class height href loading rel role src target title type width, plus the action attributesdata-action data-text data-name data-payload data-product-id data-forward-to data-url data-target. - No
styleattribute. Style the card with the template’s CSS. href,srcanddata-urlmust be https.data-payloadmust be valid JSON of at most 4 KB.data-textis cut at 500 characters.- Links get
rel="noopener noreferrer"and open in a new tab unlesstarget="_self"; links to your own site always open in the same tab (Site navigation). Images getloading="lazy"and no referrer. Buttons are forced totype="button".
Actions in templates
Section titled “Actions in templates”Use plain attributes. The widget delegates clicks:
<button data-action="reply" data-text="Show me cheaper ones">Cheaper</button><button data-action="callback" data-name="addToCart" data-product-id="{{id}}" data-payload='{"qty":1}'>Add to cart</button><a href="{{url}}">View</a>For callback, the product in the event comes from the stored card data by data-product-id, never from the page’s HTML.