Messages Format

Messages Format

We have a standard model for all our assistant messages, our APIs expecting these messages coming in JSON format, each message object supports the following properties:

Property

Type

Description

type

String

Specify message type that can take the following values (MESSAGE, SELECTION) 

messageType

String

In case of MESSAGE, you can specify here the message data type from the following values. (TEXT, IMAGE, VIDEO, AUDIO, FILE)

selectionType

String

In case of SELECTION type, we can specify here the selection type from the following values. (QUICKREPLY, LISTREPLY, CARD, TEMPLATE) 

delay

Number

Makes a delay before sending the message, it is in seconds.

payloads

Array

Message payloads that should be displayed to the user.

connections

Array

Connects one action with the next actions.

fallback

Number

The ID of the fallback action in case of fallback happens

fallbackCount

Number

The number of tries until the fallback happens. Before that the assistant will send the local or global error message in each try.

inputParam

String

The name of the parameter that will be assigned with the user input. (Either if its a click on button or text input) 

keywordsGroups

Array

Adding keywords in case of messageType is SELECTION.

 

Action payloads can take different formats depending on the type of message and the payloads property is an array that may contain different item types. The next table clears out different scenarios using the "payloads" property:

Case

Type

Description

MESSAGE→TEXT

Array<String>

Assistant will randomly pick a message to send to the user.

MESSAGE→IMAGE

Array<String>

One item with an image URL that the assistant will display.

MESSAGE→VIDEO

Array<String>

One item with the video URL that the assistant will display.

MESSAGE→AUDIO

Array<String>

One item with the audio URL that the assistant will display.

MESSAGE→FILE

Array<String>

One item with file URL that the assistant will send to the user.

SELECTION→TEMPLATE

Array<Template>

Whatsapp template for businesses.

SELECTION→QUICKREPLY

Array<Button>

Buttons will be sent to the user, allowed max 3 buttons.

SELECTION→ CARD

Array<Card>

Cards will be sent to the user, allowed max 3 buttons.

SELECTION→ LISTREPLY

Array<List>

Lists will be sent to the user, allowed max 10 sections.

 

While most of the time payloads is an array of strings, in case of selection action it should contain objects defining the cards or buttons. The next table shows the properties that each button can have in case you want to send only quick buttons to the user:

Property

Type

Description

text

String

The button text that will appear for the user

type

String

The button type can take one of the following values (LINK, TEXT, IFRAME, FACEBOOK IFRAME) 

value

Number

The target action ID when clicking on that button 

link

String

In case of LINK type, a URL of the page that will open when clicking on the button 

iframe

String

In the case of IFRAME or FACEBOOK IFRAME types, it will be the iframe URL. 

 

Next table shows the properties of template object

Property

Type

Description

namespace

String

Namespace of the template.

name

String

Name of the template

language

String

Language of the template

components

Array<Template>

Array of components objects containing the parameters.

 

Next table shows the properties that each components can have in case you want to send Template:

Property

Type

Description

type

String

Describes the component type.

subType

String

Optional. Used when type is set to button.

parameters

List<WhatsappParameter>

Array of parameters includes type init.

 

Next table shows the properties that each card can have in case you want to send cards either with buttons or without:

Property

Type

Description

title

String

The title of the card (max 60 char)

subtitle

String

The subtitle of the card (Be careful that this property is not supported in some channels)(min 1, max 1024 char)

text

String

The text of the card  (max 60 char)

image

String

The card image URL

buttons

Array<Button>

The card buttons (max 3 buttons)

 

Next table shows the properties that each quick reply buttons can have in case you want to send Quick Reply:

Property

Type

Description

text

String

The text of the quick reply (min 1, max 1024 char)

buttons

Array<Button>

The quick reply buttons (max 3 buttons)

 

Next table shows the properties that each buttons can have in case you want to send Quick Reply button or Card button:

Property

Type

Description

type

String

“reply” is accepted for both type.

reply

Array<ButtonReply>

Includes id and title values.

 

Next table shows the properties that each button reply objects can have in case you want to send Quick Reply button or Card button:

Property

Type

Description

id

String

UUID of reply button (max 256 char)

title

String

Title of reply button (max 20 char)

 

Next table shows the properties that each lists can have in case you want to send List Reply:

Property

Type

Description

messageBoxBody

String

message box body before user clicks button (min 1, max 1024 char)

messageBoxOptionsButtonText

String

message box button text (max 20 char)

listHeader

String

Header text of list (max 60 char)

listSections

Array<Sections>

Sections of lists with title and rows (max 10 sections)

 

Next table shows the properties that each sections objects can have in case you want to send listSections in List Reply:

Property

Type

Description

listSectionTitle

String

Title of list section (max 24 char)

listCardRows

Array<MBListCardRow>

Title of reply button (max 20 char)

 

Next table shows the properties that each MBListCardRow objects can have in case you want to send listCardRows in List Reply:

Property

Type

Description

listRowId

String

Id of list card row (min 1, max 200 char)

listRowTitle

String

Title of list card row (min 1, max 24 char)

listRowDescription

String

Description of list card row (max 72 char)

 

But we have a scenario of the user writing a message that can not be mapped to any button action. In that case, the selection action will fallback unless you defined keywords and the input match on one of them. The next table shows how to define "keywordsGroups" property of a message:

Property

Type

Description

keywords

Array<String>

An array of keywords, if the user sends one of them the assistant will be forwarded to the target action

value

Number

The ID of the next action

 

 

    • Related Articles

    • How to Use Error Messages (Fallback)

      The error messages consist of three message types: the fallback message, the action error message, and the global error message. They are used to continue the conversation when the user sends an invalid message. The module connection represents the ...
    • How to Use Integration Action

      Action usage Use the integration action when you want to call an HTTP integration endpoint to achieve some custom business needs. You can process the parameters saved during the life cycle of the assistant, and either only store them out in some ...
    • How to Use Wait for Action

      Action usage Use the wait for action when you want to control the assistant behavior from your outside system. The story begins by drag and dropping (Or simply clicking on) the Wait for action from the Actions menu on the left side of your assistant ...
    • How to Use Assistants Analysis Page

      ASSISTANT CONVERSATION REPORT TOTAL CONVERSATIONS: The total number of conversations handled by the bot. TOTAL USER MESSAGES: The total number of messages received from the user during these conversations. TOTAL ASSISTANT MESSAGES: The total number ...
    • Generative AI: Dictionary & Keys

      What are dictionary & keys? Dictionary is a feature of Generative AI, which is designed to show texts in multiple fields and update those text with only one action into those multiple fields. Keys are the pointers that we use into Gen AI Knowledge ...