From Bright Pattern Documentation
Jump to: navigation, search
• 5.19

How to send WhatsApp interactive messages using Send Message+ block

The following are the examples of the code that result in Whatsapp interactive messages when sent via Send Message+ block:


List

Type of interactive message Suggested directive Example of Send Message+ content
WA1.png
/interactive {
   "type": "list",
   "header": {
     "type": "text",
     "text": "<MESSAGE_HEADER_TEXT"
   },
   "body": {
     "text": "<MESSAGE_BODY_TEXT>"
   },
   "footer": {
     "text": "<MESSAGE_FOOTER_TEXT>"
   },
   "action": {
     "sections": [
       {
         "title": "<SECTION_TITLE_TEXT>",
         "rows": [
           {
             "id": "<ROW_ID>",
             "title": "<ROW_TITLE_TEXT>",
             "description": "<ROW_DESCRIPTION_TEXT>"
           }
           /* Additional rows would go here*/
         ]
       }
       /* Additional sections would go here */
     ],
     "button": "<BUTTON_TEXT>",
   }
 }
/interactive {
   "type": "list",
   "header": {
     "type": "text",
     "text": "Choose Shipping Option"
   },
   "body": {
     "text": "Which shipping option do you prefer?"
   },
   "footer": {
     "text": "Lucky Shrub: Your gateway to succulents™"
   },
   "action": {
     "button": "Shipping Options",
     "sections": [
       {
         "title": "I want it ASAP!",
         "rows": [
           {
             "id": "priority_express",
             "title": "Priority Mail Express",
             "description": "Next Day to 2 Days"
           },
           {
             "id": "priority_mail",
             "title": "Priority Mail",
             "description": "1–3 Days"
           }
         ]
       },
       {
         "title": "I can wait a bit",
         "rows": [
           {
             "id": "usps_ground_advantage",
             "title": "USPS Ground Advantage",
             "description": "2–5 Days"
           },
           {
             "id": "media_mail",
             "title": "Media Mail",
             "description": "2–8 Days"
           }
         ]
      }
   }
}



Reply buttons

Type of interactive message Suggested directive Example of Send Message+ content
WA 25.png


WA3.png
/interactive {
   "type": "button",
   "header": {<MESSAGE_HEADER>},
   "body": {
     "text": "<BODY_TEXT>"
   },
   "footer": {
     "text": "<FOOTER_TEXT>"
   },
   "action": {
     "buttons": [
       {
         "type": "reply",
         "reply": {
           "id": "<BUTTON_ID>",
           "title": "<BUTTON_LABEL_TEXT>"
         }
      }
   }
}
/interactive {
   "type": "button",
   "header": {
     "type": "image",
     "image": {
       "id": "2762702990552401"
     }
   },
   "body": {
     "text": "Hi Pablo! Your gardening workshop is scheduled 
for 9am tomorrow. Use the buttons if you need to reschedule. Thank you!"
   },
   "footer": {
     "text": "Lucky Shrub: Your gateway to succulents!™"
   },
   "action": {
     "buttons": [
       {
         "type": "reply",
         "reply": {
           "id": "change-button",
           "title": "Change"
         }
       },
       {
         "type": "reply",
         "reply": {
           "id": "cancel-button",
           "title": "Cancel"
         }
       }
     }



Call-to-Action URL Buttons

Type of interactive message Suggested directive Example of Send Message+ content


WA4.png
/interactive {
   "type": "cta_url",
   /* Header optional */
   "header": {
     "type": "text",
     "text": "<HEADER_TEXT>"
   },
   /* Body optional */
   "body": {
     "text": "<BODY_TEXT>"
   },
   /* Footer optional */
   "footer": {
     "text": "<FOOTER_TEXT>"
   },
   "action": {
     "name": "cta_url",
     "parameters": {
       "display_text": "<BUTTON_TEXT>",
       "url": "<BUTTON_URL>"
     }
   }
 }
/interactive {
       "type": "cta_url",
       "header": {
           "text": "Available Dates"
       },
       "body": {
           "text": "Tap the button below to see available dates."
       },
       "footer": {
           "text": "Dates subject to change."
       },
       "action": {
           "name": "cta_url",
           "parameters": {
               "display_text": "See Dates",
               "url": "<nowiki>https://www.luckyshrub.com?clickID=kqDGWd24Q5TRwo</nowiki>"
           }
       }
   }

Flows

Type of interactive message Suggested directive Example of Send Message+ content


WA 41.png
/interactive <interactive JSON> <action JSON>
/interactive {
   "type": "flow",
   "header": {
     "type": "text",
     "text": "Flow message header"
   },
   "body": {
     "text": "Flow message body"
   },
   "footer": {
     "text": "Flow message footer"
   },
   "action": {
     "name": "flow",
     "parameters": {
       "flow_message_version": "3",
       "flow_token": "AQAAAAACS5FpgQ_cAAAAAD0QI3s.",
       "flow_id": "1",
       "flow_cta": "Book!",
       "flow_action": "navigate",
       "flow_action_payload": {
         "screen": "<SCREEN_NAME>",
         "data": { 
           "product_name": "name",
           "product_description": "description",
           "product_price": 100
         }
       }
    }
 }

Single Product

Type of interactive message Suggested directive Example of Send Message+ content


WA6.png







WA7.png




/interactive <interactive JSON> <action JSON>
/interactive {
   "type": "product",
   "body": {
     "text": "BODY_TEXT"
   },
   "footer": {
     "text": "FOOTER_TEXT"
   },
   "action": {
     "catalog_id": "CATALOG_ID*",
     "product_retailer_id": "ID_TEST_ITEM_1"
   }
}



Multi- Product

Type of interactive message Suggested directive Example of Send Message+ content


(up to 30 items)

WA8.png







WA9.png
/interactive <interactive JSON> <action JSON>
/interactive {
   "type": "product_list",
   "header":{
     "type": "text",
     "text": "HEADER_CONTENT"
   },
   "body": {
     "text": "BODY_CONTENT"
   },
   "footer": {
     "text": "FOOTER_CONTENT"
   },
   "action": {
     "catalog_id": "CATALOG_ID",
     "sections": [
       {
         "title": "SECTION_TITLE",
         "product_items": [
           { "product_retailer_id": "PRODUCT-SKU" },
           { "product_retailer_id": "PRODUCT-SKU" }
         ]
       },
       {
         "title": "SECTION_TITLE",
         "product_items": [
           { "product_retailer_id": "PRODUCT-SKU" },
           { "product_retailer_id": "PRODUCT-SKU" }
         ]
       }
     ]
   }
}



Catalog

Type of interactive message Suggested directive Example of Send Message+ content


WA 28.png










WA11.png



/interactive {
   "type" : "catalog_message",
   "body" : {
     "text": "<BODY_TEXT>"
   },
   "action": {
     "name": "catalog_message",
     /* Parameters object is optional */
     "parameters": {
       "thumbnail_product_retailer_id": "<THUMBNAIL_PRODUCT_RETAILER_ID>"
     }
   },
   /* Footer object is optional */
   "footer": {
     "text": "<FOOTER_TEXT>"
 }
}
/interactive {
   "type": "catalog_message",
   "body": {
     "text": "Hello! Thanks for your interest. 
Ordering is easy. Just visit our catalog and add items to purchase."
   },
   "action": {
     "name": "catalog_message",
     "parameters": {
       "thumbnail_product_retailer_id": "2lc20305pt"
     }
   },
   "footer": {
     "text": "Best grocery deals on WhatsApp!"
   }
 }

Location Request

Type of interactive message Suggested directive Example of Send Message+ content


WA 12.png
/interactive {
   "type": "location_request_message",
   "body": {
     "text": "<BODY_TEXT>"
   },
   "action": {
     "name": "send_location"
   }
}
/interactive {
   "type": "location_request_message",
   "body": {
     "text": "Let us start with your pickup. 
You can either manually *enter an address* or *share your current location*."
   },
   "action": {
     "name": "send_location"
   }
}



Address

Type of interactive message Suggested directive Example of Send Message+ content


WA15.png


















/interactive <interactive JSON> <parameters JSON>
/interactive {
       "type": "address_message",
       "body": {
           "text": "Thanks for your order! 
Tell us what address you’d like this order delivered to."
       },
       "action": {
           "name": "address_message",
           "parameters": "JSON Payload"
       }
   }
< Previous