Create a WhatsApp Template with Quick-Reply Button

POST Method

Kaleyra allows you to create WhatsApp templates with dynamic payloads with quick reply messages. This template type API allows you to add a payload to your WhatsApp messages in the form of Quick Reply buttons. Once the end-customer clicks the Quick Reply button in WhatsApp messages, they get redirected based on the configured payload tasks in the WhatsApp messages.

For example, if you have configured an automated message for items available for checkout in your cart, after the defined waiting time, an automated WhatsApp message gets triggered where you can provide options to check out the items in the cart by paying the bills, delete the items, or moving them to the wishlist.

📘

Limitation:

You can only add a maximum of three dynamic payloads in any given template to the Quick Reply buttons.

Pre-requisites

The following are the prerequisites:

Base URL

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

API request to Create a WhatsApp Template with Dynamic Payload in Quick Reply Buttons

To create a WhatsApp template with a dynamic payload, use the /whatsapp/template endpoint.

Request Format

The following is the request format to create a WhatsApp Template with a Dynamic Payload in Quick Reply buttons:

curl --location --request POST 'https://api.kaleyra.io/v1/<SID>/whatsapp/template' \
--header 'api-key: {{api-key}}' \
--header 'Content-Type: {{content_type}}' \
--data-raw '{
	"name":"{{template_name}}",
	"language":"{{template_language}}",
	"category":{{template_category}},
	"header":{{header_content_type}},
	"header_content":"{{header_content}}",
	"body": "{{message_body}}",
	"footer_content": "{{footer_content}}",
	"waba_id": {{whatsapp_business_id}},
  "type": "{{type}}",
        "sub_type": "{{sub_type}}",
        "index": "{{index}}",
        "parameters": [
          {
            "type": "{{parameter_type}}",
            "payload": "{{payload}}"
          }
        ]
}'

Sample Request

The following is the sample request to create a WhatsApp Template with a Dynamic Payload in Quick Reply buttons:

curl --location --request POST 'https://api.kaleyra.io/v1/HXXXXXXX071US/whatsapp/template' \
--header 'api-key: Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3' \
--header 'Content-Type: application/json' \
--data-raw '{
	"name":"new_template_1",
	"language":"en",
	"category":"marketing",
	"header": {
      "type": "none"
   },
	"body": "Hi {{$1}},This is WhatsApp test message.",
	"footer_content": "footer",
	"waba_id": xxxxxxxxxxxxxx74443,
  "type": "button",
        "sub_type": "quick_reply",
        "index": "0",
        "parameters": [
          {
            "type": "payload",
            "payload": "Text to send to customer"
          }
        ]
}'

Parameters and Data Types

Following is the list of parameters and data types supported:

ParameterData TypeDescriptionExampleMandatory
sidStringAccount SID (Security Identifier).HXXXXXXX071USYes
content-typeStringThe format in which the data is sent.application/x-www-form-urlencodedYes
api-keyStringAPI key generated from Kaleyra.io account.Axxxxxxxxxxxxxxxxxxxxxxxxxxxx3Yes
nameStringTemplate name.new_template_1Yes
languageStringThe language in which you want to create the template.en_usYes
categoryStringSelect one of the following:
  • Marketing -Authentication
  • Utility
MarketingYes
header_content_typeStringSelect one of the following:
Text
Image
Video Document
None
TextYes
header_contentStringHeader textTextYes
bodyStringBody of the message.Hi, this is a WhatsApp test message.Yes
footer_contentStringFooter textTextNo
waba_idStringWhatsApp Business Account IDxxxxxxxxxxxxxx74443Yes
typeStringIt can be one of the following:
  • text
  • template
  • mediatemplate
  • location
  • contacts
  • list
  • reply
  • singleproduct
  • multiproduct
  • button
  • *Note**: In case of quick-reply use "button".
buttonYes
sub_typeStringIt can be one of the following:
  • QUICK_REPLY
  • PHONE_NUMBER
  • URL
    For a template with dynamic payload in Quick Reply, use “Quick Reply”.
quick-replyYes
indexStringSet the index value as 0 to get the payload when the first Quick Reply button is clicked in the incoming callback.0Yes
parameter_typeStringDefine the parameter type for payload in the quick-reply button.payloadNo
payloadStringThe payload data you want to send when the customer clicks the quick-reply button.Text to send to customer.No

Sample Success Response

The following success message appears with status 200:

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

Sample error response

The following is a sample error response.

{  
    "code": "RBC201",  
    "message": "Incorrect SID or API key.",  
    "data": [],  
    "error": {  
        "error": "Incorrect SID or API key."  
    }  
}

Error Codes

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

📘

Note:

For more information about, how to send a message with dynamic payload in the quick-reply button, see Send a Message with Dynamic Payload in Quick-reply Button.





© 2026 Kaleyra Inc. All rights reserved.
Trademarks, logos and service marks displayed on this site are registered and unregistered trademarks of Kaleyra Inc.