Skip to content

Write message templates

A message template is reviewed, exact-wording copy the agent delivers verbatim: an Outreach opener, a booking confirmation, a legal notice. Where Playbooks produce generated conversation, a template renders the same way every time.

This document describes writing one. Templates are edited at Build · Behavior · Message Templates, where each template in the list is shown as the message it sends. The same composer opens when you write an Outreach's opener in place on Build · Outreach.

The composer

Choose Edit on a template, or New message template, to open the composer: the message on the left and a live preview on the right (the preview moves underneath on a narrow screen).

The composer has two views of the same message:

  • Design shows it as you would read it: text, cards, carousels, pictures and quick replies, each edited in place.
  • Source shows the markup the template is stored as, which is the AML described in the rest of this guide. Edit it directly when you prefer. Changes in either view show in the other.

Fields

Type {, or click the { } button at the edge of a text box, to insert a field such as the person's first name. The picker lists the Person fields, the custom fields declared under Capabilities · People fields, and the agent's own details. Keep typing to narrow the list; Enter inserts the highlighted field.

A field shows as a pill, such as First name, and is inserted or deleted as a whole. Click it to choose what happens when the value is empty for a recipient:

  • Use this instead…: fallback text, for example "there" in "Hi there".
  • Template rule: follow the template's If a field is empty setting.
  • Leave out the sentence: drop the sentence the field is in.
  • Skip the whole message: send nothing to that person.
  • Don't send — report it: refuse the send and report the missing value.

Anychat flags a field this agent does not have, which would always be empty. It also flags an agent detail, such as the company name, that has not been set on Behavior · Identity yet.

Cards, carousels and quick replies

The bar under each message adds content:

  • Card: a picture from the agent's media library or an image URL, a title, a description, and up to four buttons (reply, open a link, call a number).
  • Carousel: two or more cards side by side. Add, reorder and remove cards, and choose their width.
  • Picture: an image from the media library, sent on its own.
  • Quick reply: a tappable reply under the message.
  • More: a text block, a Link button or Call button under the message, or cards filled from Things or a collection in Knowledge.

Add another message starts a second bubble, sent right after the first.

Markup that the Design view does not edit, such as a choice question or a Things marker, appears as a Markup block holding the markup text. It is sent exactly as written, and you can edit it there. Anychat rewrites a template's markup only when you change the template; opening it changes nothing.

Preview

The preview renders the message as you type, before it is saved. It shows what a rich channel such as RCS displays. SMS receives a plain-text version with numbered choices, which Anychat produces automatically.

  • Sample person fills every field with example values. The agent's own details come from the agent.
  • Unknown person leaves every Person field empty, so you can see each fallback: the replacement text, the dropped sentence, or a note that the message would be skipped or refused.

Under the message the composer also notes what a rich channel will change, for example a button label longer than 25 characters, more than 11 quick replies, or a carousel of more than 10 cards. These notes are advice. The message still sends.

Slots

A template's body is plain text with {slot} placeholders filled in per recipient at send time. In Source view, or in the API, a field is written like this:

Hi {person.firstName}, this is {agent.companyName}. You asked about
{person.productInterest}; happy to answer questions or set up a quick
call with our team.

Slots draw from the Person record ({person.…}: firstName, lastName, fullName, email, phone, company, title, productInterest, source) and the agent's identity ({agent.…}). Each template sets what happens when a value is missing for a recipient: supply a fallback rendering, or skip sending to that person. A single field can override that rule inline: {person.firstName | "there"} for fallback text, or {person.company | omit-sentence}, | omit-message or | block-send.

Set the fallback deliberately. A greeting that renders "Hi there" is fine. A confirmation missing its date is not worth sending.

Rich cards, carousels and media

A body can carry the same rich-messaging markup the agent writes: quick-reply chips, a card, a carousel of cards, a second bubble. Every picture in it comes from the agent's media library, named by id.

Here's a quick look at what we do.
[[carousel
Authentic AI Conversations ~ No more dead-end auto-replies. | media: image:showcase-authentic-ai
Rich, Verified Media ~ Images, carousels and verified badges. | media: image:showcase-media]]
[[chips: Book a demo | How does it work?]]

The composer's picture picker writes these image:<id> references for you. A channel that cannot show cards, such as SMS, gets the text of each card with the picture as a link, and the template still sends. The full marker reference is in AML.

Embedding Things and collections

A body can also pull live cards from your Things catalog instead of hand-building a carousel:

Here's what's available this week.
[[things: Lake view suite, Garden suite]]

things: takes a comma-separated list of Thing ids or names and renders each as a card, the same way a hand-built showcase does. products: still works as the older spelling of the same marker.

An entry can be a fill-in, so the card depends on who receives the message:

Thanks for your interest in {person.productInterest | omit-sentence}.
[[things: {person.productInterest | ""}]]

The fill-in is substituted first. If the value then names a Thing, that Thing's card is sent. If it names nothing, the card is left out and the text still goes out.

Cards appear only where the body asks for them. A template that just mentions a Thing by name sends that name as text, with no card.

To show a whole collection instead of naming each Thing:

Here's everything on the water this week.
[[collection: rentals]]

collection: takes a collection id and renders every Thing in it, in the collection's order. Add limit=N to cap how many cards show: [[collection: rentals limit=4]]. Anychat also caps the cards it sends at the channel's own carousel limit regardless of limit — up to 10 on RCS, fewer on channels with a smaller limit. An empty collection sends nothing; the surrounding prose still goes out.

A name or id that matches nothing in the catalog is dropped with a warning, as an unknown template reference is. Behavior lint flags a things: or products: entry that does not resolve as messageTemplate.marker.unknownThing, and a collection: id that doesn't resolve as messageTemplate.marker.unknownCollection. Both are errors. Entries that are fill-ins aren't checked, because their value is only known at send time.

Pull in another template

A template can pull in another template by id, one level deep, so shared copy lives in one place:

Welcome back! Here's what's on the water this week.
[[template: boat-rental-carousel]]

An id that does not exist is dropped, and the rest of the template still sends. Behavior lint flags it as template.ref.unknown.

Who uses templates

An Outreach uses a template as the opener of a conversation the agent starts, and its follow-up is a template too. A follow-up is sent as a single plain text message, so its composer offers text and fields only.

A Playbook references templates in its body, so the agent sends reviewed copy at the right moment: a booking confirmation when the appointment is set, a disclosure before a regulated topic, a showcase carousel right after the person's first reply.

Write the instruction in the Playbook body the way you would explain it to a colleague. Three forms count as a reference: template:<id> written in the instructions, [[template: <id>]], or the template's name in quotes. Plain prose that happens to contain the id or name does not count.

When the user asks about dining, send them [[template: resort-dining-carousel]].
When they ask about boats, ask which marina first, then send
template:wahweap-watercraft-rentals or
template:halls-crossing-watercraft-rentals.

Template copy is sent before the agent's own sentence in the same message, so write the surrounding prose to sit above a card rather than to introduce one.

The agent sees a short index of every template on every turn: id, name, and purpose. Referencing one in a Playbook's when-to-use, body, or an example is what adds that template's full body to what the agent reads while the Playbook is active. A Playbook's Also inline these templates control covers the rare case where you want a body inlined without referencing it anywhere in the Playbook's own text.

A template used nowhere does nothing. After writing one, reference it in a Playbook or make it an Outreach's opener.

When the agent may use a template

Each template has a Use setting that controls whether the agent can choose it on its own.

When it fits, the default, lets the agent send the template whenever it judges the moment right, the same way it decides what to say. Most templates work this way: a showcase carousel, a booking confirmation, a piece of reusable copy.

Only when named lets the agent send the template only on a turn whose active Playbook names it, through template:<id> in the instructions, [[template: <id>]], the template's name in quotes or backticks, or the Playbook's Also inline these templates override. A Playbook that never names it leaves the template off the table even when the person asks for it directly.

Use only when named for copy the agent must never volunteer: a consent notice that has to go out at a deliberate point in the conversation, or a legal disclaimer that belongs to one regulated topic and nowhere else. An Outreach opener is worth setting this way too, so it never turns up as a reply to something unrelated.

An Outreach names its opener and follow-up by id rather than by the model's judgment, so only when named never blocks them.

An only when named template that no Playbook names and no Outreach references can never be sent. Behavior lint flags it as messageTemplate.onlyWhenNamed.unreachable.

Writing for messaging

Template copy lands in a chat thread rather than an inbox. Two or three sentences, one idea, one call to action. When the message needs a paragraph of qualifications, those qualifications belong in the conversation the agent has after the person replies.

What's next