Message Variables

All bot and agent messages, as well as templates, can include context variables. Variables are indicated by the double mustaches {{ and }} tags around them.

A typical template:

Hello {{contact.givenName}}, your {{data.MyCarBrand}} is ready!

When said to a contact named Chris, with a Maintenance form result for his Mercedes, this will produce the following:

Hello Chris, your Mercedes is ready!

context

Variables can be used in chat bubbles, canned responses, articles and WhatsApp templates. It works by expanding tags in a message text using values provided by the current running context.

Most variables have a namespace prefix. The following variable types are available:

Agent Name

The full name of the user sending the message.

Example:

Cheers, {{agentName}}

Contact Profile Attributes

Contact profile attributes have the contact prefix. In the context of a contact conversation, the following contact profile attributes are commonly used as variables:

  • name
  • givenName
  • familyName
  • email
  • telephone

Example:

Hello {{name}}

Returns the full name of the contact

Hello Richard Robinson

Custom Data (static form) Attributes

In addition to the fixed contact profile fields, custom contact data attributes (underneath the contact profile in the UI) can be used as variables using the data prefix.

These consist of the account handler and components for the customer's own- and target cars.

List of data fields:

  • AccountRep
  • MyCarVIN
  • MyCarLicensePlate
  • MyCarBrand
  • MyCarModel
  • MyCarYear
  • MyCarMileage
  • MyCarDamage
  • MyCarLocation
  • TradeIn
  • TargetCarVIN
  • TargetCarLicensePlate
  • TargetCarType
  • TargetCarBrand
  • TargetCarModel
  • TargetCarYear

Examples:

Your assigned account representative is {{data.AccountRep}} The VIN of your car is {{data.MyCarVIN}}

Forms and Results

Conversations forms and results variables are typically used to follow up. They are prefixed with form or result, followed by a form ID. For a full list of available form IDs and fields, review the Forms, Fields and Results chapter.

Form Values

Forms that are currently active have their values exposed as message variables.

Example:

We will book your testdrive on {{form.64b317386170235fe4b6f24c.AppointmentDate}}.

Result Values

Values in the most recent 10 results are available as variables through the result prefix followed by the form name.

Example:

You have a workshop appointment at {{result.64b317386170235fe4b6f277.AppointmentTime}} on {{result.64b317386170235fe4b6f277.AppointmentDate}}

Message Meta Variables

Any message.meta properties that were passed with the message are available as non-prefixed variables. This can be useful when sending WhatsApp templated messages and for bots.

Example:

Request: POST /v2/conversations/590bd49f458b716046347f47/messages

{
    "type": "chat",
    "text": "You live in {{city}}",
    "meta": {
        "city": "Amsterdam"
    }
}

context

The following variables generate links to consumer media:

  • {{video}}
  • {{messenger}} or {{facebook}}
  • {{whatsapp}}

Using variables in WhatsApp templates

All the variables referenced above may be used when submitting new WhatsApp templates for approval. When using a WhatsApp Templated Message in a conversation, the correct values will be passed along to Facebook to be merged in.

WhatsApp Template Message