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:
- The Catalog should be linked to the WABA ID being used.
- Businesses must have inventory uploaded to Meta in an e-commerce catalog connected to their WhatsApp Business Account.
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:
Parameter | Data Type | Description | Example | Mandatory? |
---|---|---|---|---|
sid | String | Account SID (Security Identifier). | HXXXXXXX071US | Yes |
api_key | String | API key generated from kaleyra.io account. | Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3 | Yes |
name | String | Template name. | catalog_test | Yes |
category | String | The Marketing is only supported Category. | Marketing | Yes |
language | String | The language in which you want to create the template. | en_us | Yes |
header | JSON | Only type None is supported for the WhatsApp catalog template. | {type:none} | Yes |
body | String | Body 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_datatype | List of JSON | Only 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_body | String | Sample 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 |
footer | String | Body of the footer. | This is the footer text | No |
waba_id | String | WhatsApp Business Account ID | xxxxxxxxxxxxxx74443 | Yes |
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.
Updated 9 months ago