Overview

Brands can now send single or multiple product messages on Whatsapp Business Messaging. This allows the consumer to view the product(s), ask questions about given products as well as submit a shopping cart.

There however are a few steps a brand must do prior to being able to send product messages and this includes creating a new product catalog (https://www.facebook.com/business/help/1275400645914358?id=725943027795860) and sharing it with LivePerson. Please reach out to your account representative for detailed instructions.

Structure

It's important to note that Product Messages has only one orientation option and that is of type "Vertical"

Single Product Message has the following structure

  1. Header (required only if no body & footer are present else the element is ignored)
  2. Body (optional)
  3. Footer (optional)

Examples Of WhatsApp Single Product Message:

Whatsapp Single Product Message Examples

Multiple Product Message has the following structure

  1. Header (required)
  2. Body (required)
  3. Footer (optional)

Examples Of WhatsApp Multiple Product Message:

Whatsapp Multiple Product Message Examples

JSON Template Properties

Property Name Description Type Required
type WhatsApp Product Message can only have type of "Vertical" Enum Y
tag Tag of template view, must be “generic” for Viber rich content templates. Enum Y
elements Array of elements/templates. By using elements in your structured content template, you can send basic elements, such as header, body, footer Elements/Templates Y
text The text that will appear in the assigned element. The tag property of this object is what assigns the type of section the text is assigned to. Tag options are as followed: "header", "body", and "footer" String Y

Metadata Template Properties

Metadata is required for both Single and Multiple Product messages and contains the required data so that WhatsApp displays the appropriate products in the desired formatting.

Property Name Description Type Required
type Types are either "WhatsAppSingleProduct" or "WhatsAppMultipleProduct" Enum Y
catalogId The catalog the products being sent belong to. string Y
productRetailerId The product id to send to the WhatsApp user string Y (Single Mode Only)
sections An array of section objects array Y (Multiple Mode Only)
section object
title The title of the section string Y
productIds The products ids to be shown under the section string[] (30 max length) Y

Code Examples

Single Product Message

{
  "type": "vertical",
  "tag": "generic", 
  "elements": [
    {
      "type": "text",
      "text": "Check out this amazing shoe!",
      "tag": "body"
    },
    {
      "type": "text",
      "text": "Cool Shoes",
      "tag": "footer"
    }
  ]
}

Single Product Message Metadata

[
   {
      "type":"WhatsAppSingleProduct",
      "catalogId":"7091398035386734",
      "productRetailerId":"kjhjh435"  
   }
]

Multiple Product Message

{
  "type": "vertical",
  "tag": "generic", 
  "elements": [
    {
      "type": "text",
      "text": "Shoes on sale!",
      "tag": "header"
    },
    {
      "type": "text",
      "text": "Take a peek at all these wonderous shoes that we have on sale!!",
      "tag": "body"
    },
    {
      "type": "text",
      "text": "Click here to view",
      "tag": "footer"
    }
  ]
}

Multiple Product Message Metadata

[
  {
    "type": "WhatsAppMultipleProduct",
    "catalogId": "7091398035386712",
    "sections": [
      {
        "title": "Shoes",
        "productIds": [
          "retg4gg",
          "dfgfdg87df"
        ]
      },
      {
        "title": "Cheaper Shoes",
        "productIds": [
          "lkdfjgljdsfg",
          "fgfdgdfgfdsg"
        ]
      }
    ]
  }
]

Consumer Responses

A consumer can interact with product messages by either asking a question about a product or submitting a shopping cart. In both cases, a text message with additional metadata will be send to the bot/agent.

Product Question Message Metadata

[
  {
    "type": "MessageReplyContext",
    "whatsappExternalId": "342334",
    "whatsappReplyToExternalId": "34524234",
    "whatsappReplyToMessageId": "343242",
    "whatsAppProductQuestion": {
      "catalogId": "catalogId",
      "productRetailerId": "productRetailerId"
    }
  }
]

Product Order Message Metadata

[
  {
    "type": "WhatsAppOrder",
    "catalogId": "catalogId",
    "products": [
      {
        "productRetailerId": "productId",
        "quantity": 1,
        "price": "1.99",
        "currencyType": "USD"
      }
    ]
  }
]

Extract Consumer Metadata

To extract user response metadata, brands can use getMetadata function under Process User Response code of question in the bot flow, see this section

Code Examples

var messageReplyContextMetaData = botContext.getMetadata("MessageReplyContext")
var whatsAppOrderMetadata = botContext.getMetadata("WhatsAppOrder");

The messageReplyContextMetaData variable receives the MessageReplyContext from the metadata Javascript object array. Similarly, whatsAppOrderMetadata variable receives the WhatsAppOrder from the metadata Javascript object array.

Currently, it isn’t possible to convert the object array to JSON. However, you can extract it and save it to the botContext like so:

For MessageReplyContext metadata:

var metadataByType = botContext.getMetadata("MessageReplyContext");

var type = metadataByType[0].type;
var whatsappExternalId = metadataByType[0].whatsappExternalId;

botContext.setBotVariable("type", type, true, false);
botContext.setBotVariable("whatsappExternalId", whatsappExternalId, true, false);

Similarly, for WhatsAppOrder metadata:

var metadataByType = botContext.getMetadata("WhatsAppOrder");

var type = metadataByType[0].type;
var catalogId = metadataByType[0].catalogId;

botContext.setBotVariable("type", type, true, false);
botContext.setBotVariable("catalogId", catalogId, true, false);