The examples below apply to both the Send a WhatsApp message directly API and the Enqueue a WhatsApp message API.
Starting with template messages is an easy way to initiate a conversation. Once the customer replies to the business's template message, the business can begin sending any type of message to the customer in 24 hours (or 72 hours for free-entry point conversations).
Authentication template message with one-time password buttons
In this case, you have an Authentication template with Copy Code button, Authentication template with One-Tap button, or Zero-Tap Authentication template, and send a template message:
- Contains a one-time password or verification code to be delivered to the customer.
- Contains a
copy code
button, aone-tap autofill
button, or no button at all if usingzero-tap
.


ZERO-TAP
Code sample
curl 'https://wabapi.yoni-tech.com/v2/whatsapp/messages/sendDirectly' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{YOUR-API-KEY}}' \
-d '{
"from": "{{BUSINESS-PHONE-NUMBER}}",
"to": "{{CUSTOMER-PHONE-NUMBER}}",
"type": "template",
"template": {
"name": "otp_one_tap",
"language": {
"code": "en_US",
"policy": "deterministic"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "797011"
}
]
},
{
"type": "button",
"sub_type": "url",
"index": "0",
"parameters": [
{
"type": "text",
"text": "797011"
}
]
}
]
}
}'
Note
- The message body text will contain the verification code found in the body component. On the other hand, the code that is really used when users click the one-tap or copy code buttons is the one in the button component. They ought to be the same in most cases.
Template message with variables
In this case, you have a Utility template with variables in body, and send a template message:
- Contains text with 3 variables in the body.

Code sample
curl 'https://wabapi.yoni-tech.com/v2/whatsapp/messages/sendDirectly' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{YOUR-API-KEY}}' \
-d '{
"from": "{{BUSINESS-PHONE-NUMBER}}",
"to": "{{CUSTOMER-PHONE-NUMBER}}",
"type": "template",
"template": {
"name": "order_confirmation",
"language": {
"code": "en_US",
"policy": "deterministic"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "ORDER-TITLE"
},
{
"type": "text",
"text": "9.9 USD"
},
{
"type": "text",
"text": "February 25"
}
]
}
]
}
}'
Note
- Make sure that the corresponding template has been approved.
- Set the right
type
for messages you send. In this case,type
is set totemplate
, and thecomponents
andparameters
of the messaging request must match the template.
Template message with image and Quick Reply buttons
In this case, you have a Marketing template with image and Quick Reply buttons, and send a template message:
- Contains an image in the header.
- Contains text with 1 variable in the body.
- Contains text in the footer.
- Contains 2 Quick Reply buttons. The maximum number of Quick Reply buttons is 3.

Code sample
curl 'https://wabapi.yoni-tech.com/v2/whatsapp/messages/sendDirectly' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{YOUR-API-KEY}}' \
-d '{
"from": "{{BUSINESS-PHONE-NUMBER}}",
"to": "{{CUSTOMER-PHONE-NUMBER}}",
"type": "template",
"template": {
"name": "marketing_friday",
"language": {
"code": "en_US",
"policy": "deterministic"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://xxxxx/api-docs/sample/sample.jpg"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Lucy"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": 0,
"parameters": [
{
"type": "payload",
"payload": "more_about_marketing_friday"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": 1,
"parameters": [
{
"type": "payload",
"payload": "unsubscribe_marketing_notifications"
}
]
}
]
}
}'
Note
- The
caption
parameter (Used to describe the specifiedimage
,video
, ordocument
media.) is unsupported intemplate
orinteractive
messages.- For more information about header media limitations, see Supported Media Types.
Template message with video and Call To Action buttons
In this case, you have a Marketing template with video and Call To Action buttons, and send a template message:
- Contains a video in the header.
- Contains text with 1 variable in the body.
- Contains text in the footer.
- Contains 2 Call To Action buttons: 1
PHONE_NUMBER
button, and 1URL
button. TheURL
button can have at most 1 variable at the end of theURL
.

Code sample
curl 'https://wabapi.yoni-tech.com/v2/whatsapp/messages/sendDirectly' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{YOUR-API-KEY}}' \
-d '{
"from": "{{BUSINESS-PHONE-NUMBER}}",
"to": "{{CUSTOMER-PHONE-NUMBER}}",
"type": "template",
"template": {
"name": "marketing_friday_more",
"language": {
"code": "en_US",
"policy": "deterministic"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "video",
"video": {
"link": "https://xxxxx/api-docs/sample/sample.mp4"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "The Friday"
}
]
},
{
"type": "button",
"sub_type": "url",
"index": 0,
"parameters": [
{
"type": "text",
"text": "qptHJVK2EjU"
}
]
}
]
}
}'
Note
- The
caption
parameter (Used to describe the specifiedimage
,video
, ordocument
media.) is unsupported intemplate
orinteractive
messages.
Coupon template message
In this case, you have a Coupon template, and send a template message:
- Contains text with 2 variables in the body.
- Contains 1 Copy Code button.

Code sample
curl 'https://wabapi.yoni-tech.com/v2/whatsapp/messages/sendDirectly' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{YOUR-API-KEY}}' \
-d '{
"from": "{{BUSINESS-PHONE-NUMBER}}",
"to": "{{CUSTOMER-PHONE-NUMBER}}",
"type": "template",
"template": {
"name": "marketing_coupon",
"language": {
"code": "en_US",
"policy": "deterministic"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Tom"
},
{
"type": "text",
"text": "25OFF"
}
]
},
{
"type": "button",
"sub_type": "copy_code",
"index": 0,
"parameters": [
{
"type": "coupon_code",
"coupon_code": "25OFF"
}
]
}
]
}
}'
Note
- Coupon codes are limited to 15 characters.
- Button text cannot be customized.
Limited-Time Offer template message
In this case, you have a Limited-Time Offer template, and send a limited-time offer (LTO) template message:
- Contains an image in the header.
- Displays expiration dates and running countdown timers for the offer code.
- Contains text with 2 variables in the body.
- Contains 2 buttons: 1
COPY_CODE
button, and 1URL
button.

Code sample
curl 'https://wabapi.yoni-tech.com/v2/whatsapp/messages/sendDirectly' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{YOUR-API-KEY}}' \
-d '{
"from": "{{BUSINESS-PHONE-NUMBER}}",
"to": "{{CUSTOMER-PHONE-NUMBER}}",
"type": "template",
"template": {
"name": "limited_time_offer_caribbean_pkg_2024",
"language": {
"code": "en_US",
"policy": "deterministic"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://xxxxx/api-docs/sample/sample.jpg"
}
}
]
},
{
"type": "limited_time_offer",
"parameters": [
{
"type": "limited_time_offer",
"limited_time_offer": {
"expiration_time_ms": 1698118200000
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "Tom"
},
{
"type": "text",
"text": "C025"
}
]
},
{
"type": "button",
"sub_type": "copy_code",
"index": "0",
"parameters": [
{
"type": "coupon_code",
"coupon_code": "C025"
}
]
},
{
"type": "button",
"sub_type": "url",
"index": "1",
"parameters": [
{
"type": "text",
"text": "param025"
}
]
}
]
}
}'
Carousel template message
In this case, you have a Carousel template, and send a carousel template message:
- Contains text with 2 variables in the body.
- Contains 2 carousel cards in a horizontally scrollable view.

Code sample
curl 'https://wabapi.yoni-tech.com/v2/whatsapp/messages/sendDirectly' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{YOUR-API-KEY}}' \
-d '{
"from": "{{BUSINESS-PHONE-NUMBER}}",
"to": "{{CUSTOMER-PHONE-NUMBER}}",
"type": "template",
"template": {
"name": "summer_carousel_promo_2023",
"language": {
"code": "en_US",
"policy": "deterministic"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "C015"
},
{
"type": "text",
"text": "15%"
}
]
},
{
"type": "carousel",
"cards": [
{
"card_index": 0,
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://xxxxx/api-docs/sample/sample.jpg"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "C015"
},
{
"type": "text",
"text": "15%"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": 0,
"parameters": [
{
"type": "payload",
"payload": "summer_lemons_2023"
}
]
},
{
"type": "button",
"sub_type": "url",
"index": 1,
"parameters": [
{
"type": "text",
"text": "summer_lemons_2023"
}
]
}
]
},
{
"card_index": 1,
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://xxxxx/api-docs/sample/sample.jpg"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "20OFFEXOTIC"
},
{
"type": "text",
"text": "20%"
}
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": 0,
"parameters": [
{
"type": "payload",
"payload": "summer_blues_2023"
}
]
},
{
"type": "button",
"sub_type": "url",
"index": 1,
"parameters": [
{
"type": "text",
"text": "summer_blues_2023"
}
]
}
]
}
]
}
]
}
}'
Note
- Message bubbles are text-only and support variables. There is no maximum character limit on variables, but it counts against the message bubble limit of 1024 characters.
- Card body text supports variables. There is no maximum character limit on variables, but they count against the card body text limit of 160 characters.
Catalog template message
In this case, you have a Catalog template, and send a message to share your product catalog with customers.

Code sample
curl 'https://wabapi.yoni-tech.com/v2/whatsapp/messages/sendDirectly' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{YOUR-API-KEY}}' \
-d '{
"from": "{{BUSINESS-PHONE-NUMBER}}",
"to": "{{CUSTOMER-PHONE-NUMBER}}",
"type": "template",
"template": {
"name": "intro_catalog_offer",
"language": {
"code": "en_US"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "100"
},
{
"type": "text",
"text": "400"
},
{
"type": "text",
"text": "3"
}
]
},
{
"type": "button",
"sub_type": "catalog",
"index": 0,
"parameters": [
{
"type": "action",
"action": {
"thumbnail_product_retailer_id": "2lc20305pt"
}
}
]
}
]
}
}'
Note
thumbnail_product_retailer_id
is optional. The SKU number is labeled as Content ID in the Commerce Manager. The thumbnail of this item will be used as the message's header image. If theparameters
object is omitted, the product image of the first item in your catalog will be used.
MPM template message
In this case, you have an MPM template, and send a message to share products with customers.
This example sends an approved template named "abandoned_cart" and injects a variable (the customer's first name) into the template header and a discount code into the template body. It also defines two sections ("Popular Bundles" and "Premium Packages") and identifies the products (a total of 3) that should be injected into those sections.

Code sample
curl 'https://wabapi.yoni-tech.com/v2/whatsapp/messages/sendDirectly' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: {{YOUR-API-KEY}}' \
-d '{
"from": "{{BUSINESS-PHONE-NUMBER}}",
"to": "{{CUSTOMER-PHONE-NUMBER}}",
"type": "template",
"template": {
"name": "abandoned_cart",
"language": {
"code": "en_US"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "text",
"text": "Pablo"
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "10OFF"
}
]
},
{
"type": "button",
"sub_type": "mpm",
"index": 0,
"parameters": [
{
"type": "action",
"action": {
"thumbnail_product_retailer_id": "2lc20305pt",
"sections": [
{
"title": "Popular Bundles",
"product_items": [
{
"product_retailer_id": "2lc20305pt"
},
{
"product_retailer_id": "nseiw1x3ch"
}
]
},
{
"title": "Premium Packages",
"product_items": [
{
"product_retailer_id": "n6k6x0y7oe"
}
]
}
]
}
}
]
}
]
}
}'