Twilio/catalog
is used to send products or services to your customers. WhatsApp offers 3 ways to send advertise, recommend, and facilitate checkout for items or services you may have for sale. These messages can be sent in and out of session in 3 variations: single product, multi product, and whole catalog messages. Twilio has simplified all of this into 1 content template. Depending on the number of items you send, Twilio will automatically select the appropriate type of WhatsApp Product Message to deliver your message. This removes the need to build and understand WhatsApp's custom logic to choose the type of product message to send.
Sends 1 product and information about that product to your customers.
Only available within a 24 hour WA session. 1 product can be sent out of session as part of a multiproduct catalog template but the end user experience will be different. In MPM clicking the message button redirects to a list of products whereas SPM redirects directly to the item.
Single Product Message | Multi-Product Message | Full Catalog |
---|---|---|
Sends 1 product and information about that product to your customers. Only available within a 24 hour WA session. 1 product can be sent out of session as part of a multiproduct catalog template but the end user experience will be different. In MPM clicking the message button redirects to a list of products whereas SPM redirects directly to the item. | Sends 1 to 30 products and information about those products to your customers. Available in session and as an out of session approve template. 1 product can be sent out of session as part of a multiproduct catalog template but the end user experience will be different. In MPM clicking the message button redirects to a list of products whereas SPM redirects directly to the item. | Sends all product and information about that product to your customers. This functionality must be enabled for your sender |
Before creating a catalog template, you must create a catalog in your Meta Commerce Manager which can be found in your Meta Business Manager.
During a 24-hour user-initiated session, template approval is not required by WhatsApp for twilio/catalog
templates.
For out of session (business-initiated) catalog templates, you will need to submit the template for approval.
Now let's create your content template, so you can send product messages to your end users. First, find the Catalog ID in your Meta Commerce Manager in the "Catalogs" section. You will need this ID to create your content template with Twilio.
If you are sending 1 item in an approved templated message, it will be sent and approved as a multi-product message. Single product messages are only available in session.
We will now cover the various parameters you can use to create your catalog message. To create the actual body of the message you will need to specify body, subtitle, and header to define what the message actually looks like. Thumbnail id which is an item id from the list of items you specify will be needed for multi and full catalog messages to define the cover photo of the message. You will also need to define the items you will send. You can either do this by denoting that you will send the items later, you can define a static list now, or do a combination of the 2. When you define items you will need to use the item id found as content id in the catalog in the Meta Commerce Manager. And if you are defining multiple items you will need to add section titles to organize your items into sections.
id:
title:
body:
subtitle:
items:
dynamic_items:
{{products}}
. At the time of sending a message, customers can pass products as variables.id:
section_title:
This creates a template that will send a fixed list. Using "thumbnail_item_id", you can define what product's picture is shown on the message.
You can also have some items can be fixed for a message and others can be dynamic if you add "dynamic\_items": "{{products}}"
in the twilio/catalog definition. If dynamic items is defined in creation, at least 1 additional dynamic item must be added to send. If dynamic items are added, the item with id 48rme2i4po will always be sent first and all items defined in {{products}}
at send will follow.
1curl -X POST 'https://content.twilio.com/v1/Content' \2-H 'Content-Type: application/json' \3-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN \4-d '{5"friendly_name": "fixedproducts",6"language": "en",7"variables": {"1": "menu_ad", "2": "menu_name"},8"types": {9"twilio/catalog": {10"id": "1017234312776586",11"body": "Hi, check out this menu {{1}}",12"subtitle": "Great deals",13"title": "The Menu: {{2}}",14"thumbnail_item_id": "48rme2i4po",15"items": [ {"id": "48rme2i4po", "section_title": "veggies"}]16}17}18}'
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"date_created": "2024-06-10T22:16:39Z",4"date_updated": "2024-06-10T22:16:39Z",5"friendly_name": "fixedproducts",6"language": "en",7"links": {8"approval_create": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests/whatsapp",9"approval_fetch": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests"10},11"sid": "HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",12"types": {13"twilio/catalog": {14"body": "Hi, check out this menu {{1}}",15"dynamic_items": null,16"id": "1017234312776586",17"items": [18{19"description": null,20"id": "48rme2i4po",21"media_url": null,22"name": null,23"price": null,24"section_title": "veggies"25}26],27"subtitle": "Great deals",28"thumbnail_item_id": "48rme2i4po",29"title": "The Menu: {{2}}"30}31},32"url": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",33"variables": {34"1": "menu_ad",35"2": "menu_name"36}37}
This will send an end user your entire catalog. Title is prefixed by Meta as: "View {Business's name} Catalog on WhatsApp"
. No items need to be defined.
Requires sender configuration. Reach out to your Twilio point of contact or support to enable.
1curl -X POST 'https://content.twilio.com/v1/Content' \2-H 'Content-Type: application/json' \3-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN \4-d '{5"friendly_name": "Catalog - all products",6"language": "en",7"variables": {"1": "menu_title", "2": "menu_name"},8"types": {9"twilio/catalog": {10"id": "1017234312776586",11"title": "The Menu: {{1}}",12"body": "Hi, check out this menu {{2}}",13"subtitle": "Great deals",14"thumbnail_item_id": "48rme2i4po"15}16}17}'
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"date_created": "2024-06-10T22:02:53Z",4"date_updated": "2024-06-10T22:02:53Z",5"friendly_name": "Catalog - all products",6"language": "en",7"links": {8"approval_create": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests/whatsapp",9"approval_fetch": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests"10},11"sid": "HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",12"types": {13"twilio/catalog": {14"body": "Hi, check out this menu {{2}}",15"dynamic_items": null,16"id": "1017234312776586",17"items": null,18"subtitle": "Great deals",19"thumbnail_item_id": "48rme2i4po",20"title": "The Menu: {{1}}"21}22},23"url": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",24"variables": {25"1": "menu_title",26"2": "menu_name"27}28}
If you plan to send a variable number of items, we recommend you send a template
If you are only sending one item, Meta considers this a "single-product message" and only supports it in-session. When sending 1 product out of session, the message the end user receives will be slightly different. If you are sending within a 24 hour session, we recommend creating one template with all fields set as variables. You can then dynamically define each field at send time so you can minimize the number of templates you need to create.
1curl -X POST 'https://content.twilio.com/v1/Content' \2-H 'Content-Type: application/json' \3-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN \4-d '{5"friendly_name": "dynamicproducts",6"language": "en",7"variables": {"1": "Hi, check out this menu menu_name", "2": "footer text"},8"types": {9"twilio/catalog": {10"id": "1017234312776586",11"title": "The Menu: {{1}}",12"body": "{{2}}",13"subtitle": "{{3}}",14"dynamic_items": "{{products}}"15}16}17}'
1{2"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",3"date_created": "2024-06-10T22:25:37Z",4"date_updated": "2024-06-10T22:25:37Z",5"friendly_name": "dynamicproducts",6"language": "en",7"links": {8"approval_create": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests/whatsapp",9"approval_fetch": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/ApprovalRequests"10},11"sid": "HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",12"types": {13"twilio/catalog": {14"body": "{{2}}",15"dynamic_items": "{{products}}",16"id": "1017234312776586",17"items": null,18"subtitle": "{{3}}",19"thumbnail_item_id": null,20"title": "The Menu: {{1}}"21}22},23"url": "https://content.twilio.com/v1/Content/HXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",24"variables": {25"1": "Hi, check out this menu menu_name",26"2": "footer text"27}28}
You can also approve your product messages as approved WA templates to initiate a session if you want. Approval is the same as all other templates.
You are able to prefix items by specifying product id's at time of creation if you want. If you choose to send dynamic items, you will need the item's SKU item ID, known in the WABA as the Content ID. You will not need to set this product id at time of template creation but will need it at time of send.
The following code sample sends the Product Message with dynamically set items defined above.
1CONTENTVARIABLES=$(cat << EOF2{3"1": "not veggies",4"2": "Here we have some amazing and delicious fruits",5"3": "Vitamin C",6"products": "[{\"id\": \"r1cjin3eff\", \"section_title\": \"Fruits\"},{\"id\": \"d6swgbljv8\", \"section_title\": \"Fruits\"}]"7}8EOF9)1011curl -X POST "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages.json" \12--data-urlencode "ContentSid=HXXXXXXXXX" \13--data-urlencode "From=MGXXXXXXXX" \14--data-urlencode "ContentVariables=$CONTENTVARIABLES" \15--data-urlencode "To=whatsapp:+15551234567" \16-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
Component | Description |
---|---|
Messagetype | When customers ask a question Messagetype will be set to "text" |
Body | The question and/or comments raised by the customer |
ProductRetailerId | Information about the product being mentioned by the customer. You can see a product's unique identifier as well as their catalog ID. |
Component | Description |
---|---|
Messagetype | When customers ask a question Messagetype will be set to "order" |
Body | The question and/or comments raised by the customer |
ProductRetailerId | Information about the products added to the customer's shopping cart. The order object contains the catalog ID and an array called product_item, inside which you can find the list of products added to cart. Ex: {"catalog_id" : "xxx", "text" : "", "product_items" : [ { "product_retailer_id" : "id1", "quantity" : x, "item_price" : y, "currency" : "USD" }, { "product_retailer_id" : "id2", "quantity" : a, "item_price" : b, "currency" : "USD" } ] } |