Task · API
Format a message through the API
Add bold, links, headings, lists and pictures to messages and Content pages written through the API or an AI agent.
5 steps · About 3 minutes
-
Tell your connected agent what the message should say and how it should look
If you use the API yourself, send the message in the
body_markdownfield of a message or a saved message, written in Markdown as shown below. A Content page takes the samebody_markdown, with the same formatting and pictures. -
Check the draft under Messages
The email shows your formatting. A message reads back through the API in the same form, and your agent can change a message you wrote in Tito without losing its formatting.
go.tito.io/acme/summer-fetes-summer-fete/admin/messages
What you can write
| Write | To get |
|---|---|
**words** | Bold |
*words* | Italic |
[words](https://example.com) | A link |
# Words | A heading |
## Words | A subheading |
- Words | A bullet |
1. Words | A numbered step |
> Words | A line of a quote |
--- | A divider |
 | A picture |
Each line break starts a new line, and a blank line starts a new paragraph.
You can send HTML instead, such as a mailing you already have. Tito keeps the same formatting and pictures from it and drops everything else, including colors, layouts and scripts. It reads back as Markdown. A quote or a divider in HTML is not kept, so write those in Markdown.
Add a picture
Give each picture's web address, and Tito copies the picture into your account as it saves the message. The email shows Tito's copy, so changing or removing the picture on your site later doesn't change the email.
- The picture needs a public
https://address, so anyone can open it without signing in. - It needs to be a JPEG or PNG of up to 10 MB, the same as a picture added in the message editor.
- The words inside
![ ]describe the picture for anyone who can't see it, and appear in the plain text version of the email. - To make a picture a link, put it inside one:
[](https://example.com). - A picture beside words moves to its own line.
If a picture can't be copied, nothing is saved, and the message says which picture and why. A body can hold up to 20 different pictures, and an account can copy 200 pictures an hour.
Add a photo grid
Write a photo grid as a block: its shape, its size, an optional caption, and then each photo's web address in reading order.
{{ block.photo_grid | shape: 'square' | columns: '2' | rows: '1' | caption: 'Our speakers' | src: 'https://example.com/first.jpg' | alt: 'First speaker' | src: 'https://example.com/second.jpg' | alt: 'Second speaker' }}
Tito copies each photo in the same way as a picture, with the same limits, and cuts it to the grid's shape. The shape is square, portrait or landscape.
Keep the whole block on one line. A grid has one to three columns and one to ten rows. To leave a cell empty, write src: '' for it, and leave out any empty cells at the end. To make a photo a link, add to: 'event' after its alt.
Upload a picture
If you use the API yourself, you can send a picture as a file. This is the way to add a picture with no public address. Agents can't send files, so a connected agent uses a web address instead.
-
Send the file to
POST /api/v1/events/{slug}/messages/picturesPut it in the
filepart of a multipart body. It needs to be a JPEG or PNG of up to 10 MB, one in each request. For a photo in a grid, addshapewithsquare,portraitorlandscape, and Tito cuts it to that shape. -
Copy the
tokenfrom the answerSending the same file again with the same shape gives you the same token, and you can use it in as many messages as you like.
-
Write the token into
body_markdownA picture is one block:
{{ block.picture | src: 'TOKEN' | alt: 'What the picture shows' }}In a photo grid, the token goes in the photo's
src. To make a picture a link, addto: 'event'after itsalt.A token Tito doesn't know, or a photo cut to a different shape from its grid, is refused with a message naming it, and nothing is saved.
Link to places in Tito
A link can also go to somewhere Tito knows:
| Write | To link to |
|---|---|
[words](mailto:hello@example.com) | An email address |
[words](dest:order) | The person's order |
[words](dest:ticket) | The person's ticket |
[words](dest:event) | The event page |
[words](dest:invitation) | The person's invitation |
[words](page:7) | One of your pages, by its ID |
[words](audience:3) | An audience page, by its ID |
Add names and blocks
Variables and blocks use the same names they have in a message's source, which the API returns as body_source:
{{ person.first_name | default: 'there' }}is their first name, or the word you choose if it's blank.{{ person.full_name | default: 'there' }}is their full name, or the word you choose.{{ order.reference }}is the order reference.{{ ticket.type }}is the ticket type.{{ event.name }},{{ event.dates }}and{{ event.venue }}are the event's name, dates and venue, as its event page shows them.{{ block.ticket_code }}is their ticket code.{{ block.order_summary }}is a summary of what they bought.{{ block.button | to: 'order' | says: 'See your order' }}is a button.- A picture or photo grid already in a message reads back as a block. Leave it as it is to keep it.
default removes its whole line for anyone whose name is blank.Good to know
bodystays plain words. Anything typed in it, including**, appears in the email as typed. Sendbodyorbody_markdown, never both.- To change a message you wrote in Tito and keep its formatting, read
body_markdown, change it and send it back. Sending different words inbodyreplaces the message with plain words. - To show a character that means something in Markdown, put a backslash before it:
\*. - Subjects don't take formatting.
- A Content page shows pictures, photo grids, buttons and dividers. A ticket code or a summary of what somebody ordered is kept but not shown, on the page or in an email it's placed in.
- A link to any other kind of address or a name Tito doesn't know is refused with a message saying what to change.