Create WhatsApp Catalog Message Template

POST Method

Kaleyra allows you to create catalog templates that allow you to display your product catalog within WhatsApp messages. The Catalog templates display a product thumbnail header image of your choice and custom body text, along with a fixed text header and fixed text sub-header. Customers can then click on the View catalogue button to see the whole product catalog.

Sample WhatsApp Catalog Message as displayed on end-user device:

After the end-customer clicks on the View catalogue button, the product listed under the catalog appears:

Prerequisites

The following are the prerequisites for creating the catalog message template:

Base URL

https://api.kaleyra.io/v1/<SID>

API request to Create a WhatsApp Catalog Template

To create a WhatsApp catalog template, use the /whatsapp/template endpoint.

Request Format

The following is the request format to create a WhatsApp catalog message template:

curl --location --request POST '<base_url>/whatsapp/template' \
 --header 'api-key: <api_key>' \
 --form 'name="<name>"' \
 --form 'category="<category>"' \
 --form 'language="<language>"' \
 --form 'header="{\"type\":\"none\"}";type=application/json' \
 --form 'body="<body>"' \
 --form \
 'button_data="[
	{
   \"type\":\"<button_data_type>\"
}
]";type=application/json' --form 'sample_body="<sample_body>"' \
 --form 'footer="<footer>"' \
 --form 'waba_id="<waba_id>"' \

Sample Request

The following is the sample request to create a WhatsApp catalog message template:

curl --location --request POST 'https://api.kaleyra.io/v1/HXXXXXXX071US/whatsapp/template' \
 --header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
 --form 'name="catalog_test"' \
 --form 'category="marketing"' \
 --form 'language="en"' \
 --form 'header="{\"type\":\"none\"}";type=application/json' \
 --form 'body="Hello, I am the new virtual assistant. I can help you discover products or provide support. Please reach out if I can help!{{$1}}{{$2}}"' \
 --form \
 'button_data="[
	{
   \"type\":\"catalog\"
}
]";type=application/json' --form 'sample_body="Hello, I am the new virtual assistant. I can help you discover products or provide support. Please reach out if I can help!{{$1}}{{$2}}"' \
 --form 'footer="This is the footer text"' \
 --form 'waba_id="xxxxxxxxxxxxxx74443"' \

Parameters and Data Types

Following is the list of parameters and data types supported:

ParameterData TypeDescriptionExampleMandatory?
sidStringAccount SID (Security Identifier).HXXXXXXX071USYes
api_keyStringAPI key generated from kaleyra.io account.Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3Yes
nameStringTemplate name.catalog_testYes
categoryStringThe Marketing is only supported Category.MarketingYes
languageStringThe language in which you want to create the template.en_usYes
headerJSONOnly type None is supported for the WhatsApp catalog template.{type:none}Yes
bodyStringBody of the message.Hello, I am the new virtual assistant. I can help you discover products or provide support. Please reach out if I can help!{{$1}}{{$2}}Yes
button_datatypeList of JSONOnly type Catalog is supported for the WhatsApp catalog template.
You can create more than one catalog in the Business Manager and then select which catalog to send per message.
[{type:catalog}]Yes
sample_bodyStringSample of the message you want to send with Catalog.Hello, I am the new virtual assistant. I can help you discover products or provide support. Please reach out if I can help!{{$1}}{{$2}}Yes
footerStringBody of the footer.This is the footer textNo
waba_idStringWhatsApp Business Account IDxxxxxxxxxxxxxx74443Yes

Sample Success Response

The following success message appears with status 200:

{
    "status": 200,
    "message": "Template created successfully.",
    "data": [],
    "error": {}
}

Error Codes

For information related to the WhatsApp error code, see WhatsApp Error Codes.

📘

Note:

To send the WhatsApp catalog message using the template, see Send a Catalog Message through WhatsApp Template.