> ## Documentation Index
> Fetch the complete documentation index at: https://kero.chat/help/llms.txt
> Use this file to discover all available pages before exploring further.

# Object Schemas

> Reference for the JSON objects used by the Kero API.

## Introduction

This page describes some JSON objects used by the API.

## Message Content

The `MessageContent` object specifies the body of a message to send.

```ts theme={null}
{
    rcs: RCSMessage | null,
    wa: WhatsAppMessage | null,
    sms: string | null,
    fallbackChain: string[] | null,
}
```

1. The `rcs` property is a flexible data structure that specifies the [RCS message](#rcs-message).
2. The `wa` property is a JSON object that specifies a valid WhatsApp message structure.
3. The `sms` property is valid SMS text.
4. You must supply a value for one of the properties; the mandatory property depends on the provider you are sending to.
5. You may supply values for more than one property.  For instance, providing a value for `sms` is required to fall back to SMS.
6. The `fallbackChain` is an array of Brand Agent IDs.  If a message fails for a reason that triggers fallback then the next item in the chain will be tried.  The fallback processing can continue until the last item in the chain has been tried.
7. For every agent identified in the `fallbackChain` there must content for the assocciated provider type.  For example if the chain contains an SMS agent then the `sms` property must be supplied.
8. Each string in the `fallbackChain` must identify an existing agent.  These values are not verified during submit, but they are verified during processing.  An invalid entry will terminate fallback processing.
9. The `fallbackChain` cannot contain any duplicates, and it cannot contain the `agentId` associated with the send request.

## Template Content

The `TemplateContent` object specifies how you want to use a template.
See the [template create](https://kero.chat/help/kero-developer-pages/basic-api.md#message-template-create) endpoint if you want to add templates to your account.

```ts theme={null}
{
    id: string,
    model: object|null
}
```

1. The `id` object must identify an existing template.
2. If the template does not have any parameters, the `model` does not have to be supplied.
3. If the template has parameters the model contains the name-value pairs to fill in the template.
4. Every template parameter must have an entry in the model.

For example, consider a template identified by `welcome-message` and parameter names: `firstName` and `lastName`.
An object that uses this template looks like this:

```json theme={null}
{
    "id": "welcome-message",
    "model": {
        "firstName": "Bobby",
        "lastName": "McCarthy"
    }
}
```

## RCS Message

RCS messages are sent in JSON format. The structure of this object determines the type of message the recipient will see on her device.

This section introduces a few possibilities by giving you examples, but these messages are very flexible, see the [Google specifications](https://developers.google.com/business-communications/rcs-business-messaging/guides/build/messages/send) for many more ideas.

### Text message

Probably the simplest schema.

```json theme={null}
{
   "contentMessage":{
      "text":"Hello world"
   }
}
```

### URL actions

Here we ask the recipient a question, and open a web page with a URL that depends on the answer.

```json theme={null}
{
   "contentMessage":{
      "text":"What is your favourite colour?",
      "suggestions":[
         {
            "action":{
               "text":"Blue",
               "postbackData": "fav-color-blue",
               "openUrlAction":{
                  "url":"https://www.example.com?fav=blue"
               }
            }
        },
        {
            "action":{
               "text":"Red",
               "postbackData": "fav-colour-red",
               "openUrlAction":{
                  "url":"https://www.example.com?fav=red"
               }
            }
         }
      ]
   }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.