Messages Format

Prev Next

MindBehind provides a standard model for all your assistant messages. APIs expect these messages to come in JSON format, and each message object supports the following properties:

Property

Type

Description

type

String

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

messageType

String

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

selectionType

String

You can specify the selection type for the SELECTION type from the following values (QUICKREPLY, LISTREPLY, CARD, TEMPLATE).

delay

Number

It causes a delay before sending the message in seconds.

payloads

Array

Message payloads that should be displayed to the user.

connections 

Array

It connects one action to the following action.

fallback

Number

The ID of the fallback action in case a fallback happens.

fallbackCount

Number

The number of tries until the fallback happens. Before that, the assistant sends the local or global error message on each try.

inputParam

String

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

keywordsGroups

Array

Adding keywords in case the messageType is SELECTION.

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

Case

Type

Description

MESSAGE -> TEXT

Array<String>

The 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 a 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, with a maximum of 3 buttons.

SELECTION -> CARD

Array<Card>

Cards will be sent to the user, allowing a maximum of 3 buttons.

SELECTION→ LISTREPLY

Array<List>

Lists will be sent to the user, with a maximum of 10 sections.

  • While most of the time payloads are an array of strings, in the case of the Selection action, they should contain objects defining the cards or buttons. The following 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 the button is clicked.

link

String 

In the case of the LINK type, a URL of the page that will open when the button is clicked.

iframe 

String

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

  • You can check the table below to see the properties of the template object:

Property

Type

Description

namespace

String  

 The namespace of the template

name

String

The name of the template

language 

String

The language of the template

components

Array<Template>

The array of component objects containing the parameters

  • If you want to send a template, you can take a look at the table below that shows the properties that each component can have:

Property

Type

Description

type

String

It describes the component type.

subType

String

It is optional and used when the type is set to a button.

parameters

List<WhatsappParameter> 

An array of parameters includes a type.

  • If you want to send cards either with or without buttons, the following table shows the properties that each card can have:

Property

Type

Description 

title  

String 

The title of the card (max. 60 characters)

subtitle 

String

The subtitle of the card (This property is not supported in some channels)(It allows min. 1 and max. 1024 characters)

text 

String 

The text of the card (max. 60 characters)

image 

String 

The card image URL

buttons      

Array<Button>

The card buttons (max. 3 buttons)

  • If you want to send a Quick Reply, the table below shows the properties for each quick reply button:

Property

Type

Description

text

String

The text of the quick reply (at min. 1, at max 1024 characters).

buttons

Array<Button>

The quick reply buttons (max. 3 buttons)

  • If you want to send a Quick Reply button or Card button, the table below shows the properties that each button can have: 

Property

Type

Description

type

String

“reply” is accepted for both types.

reply

Array<ButtonReply>

It includes the ID and title values.

  • If you want to send a Quick Reply button or Card button, the table below shows the properties that each button reply object can have:

Property

Type

Description

id

String

UUID of reply button (max. 256 characters)

title

String

Title of reply button (max. 20 characters)

  • If you want to send a List Reply, the table below shows the properties that each list can have: 

Property

Type

Description

messageBoxBody

String

Message box body before the user clicks the button (min. 1, max. 1024 characters)

messageBoxOptionsButtonText

String

Message box button text (max. 20 characters)

listHeader

String

Header text of list (max 60 characters)

listSections

Array<Sections>

Sections of lists with titles and rows (max. 10 sections)

  • If you want to send listSections in List Reply, the table below shows the properties that each section object can have: 

Property

Type

Description

listSectionTitle

String

Title of list section (max. 24 characters)

listCardRows

Array<MBListCardRow>

Title of reply button (max. 20 characters)

  • If you want to send listCardRows in List Reply, the table below shows the properties that each MBListCardRow object can have: 

Property

Type

Description

listRowId

String

ID of list card row (min 1, max 200 characters)

listRowTitle

String

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

listRowDescription

String

Description of list card row (max 72 characters)

  • If the user writes a message that can not be mapped to any button action, the selection action will fall back unless you define keywords and the input matches one of them. The table below 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