All API Message Types — Code Examples
Marketing Template
Marketing Template
Send a promotional template with an image header and variables.
typestringMust be template.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "template",
"template": {
"name": "seasonal_promo",
"language": { "code": "en_US" },
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": { "link": "https://example.com/banner.jpg" }
}
]
},
{
"type": "body",
"parameters": [
{ "type": "text", "text": "John" },
{ "type": "text", "text": "50%" }
]
}
]
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "template",
"template": {
"name": "seasonal_promo",
"language": { "code": "en_US" },
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": { "link": "https://example.com/banner.jpg" }
}
]
},
{
"type": "body",
"parameters": [
{ "type": "text", "text": "John" },
{ "type": "text", "text": "50%" }
]
}
]
}
}
Utility Template
Utility Template
Order updates, alerts, and account notifications.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "template",
"template": {
"name": "order_update_v1",
"language": { "code": "en_US" },
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "#ORD-123" },
{ "type": "text", "text": "Shipped" }
]
}
]
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "template",
"template": {
"name": "order_update_v1",
"language": { "code": "en_US" },
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "#ORD-123" },
{ "type": "text", "text": "Shipped" }
]
}
]
}
}
Authentication Template
Authentication Template
Send One-Time Passwords (OTP) with a copy-code button.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "template",
"template": {
"name": "auth_otp",
"language": { "code": "en_US" },
"components": [
{
"type": "body",
"parameters": [ { "type": "text", "text": "123456" } ]
},
{
"type": "button",
"sub_type": "url",
"index": "0",
"parameters": [ { "type": "text", "text": "123456" } ]
}
]
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "template",
"template": {
"name": "auth_otp",
"language": { "code": "en_US" },
"components": [
{
"type": "body",
"parameters": [ { "type": "text", "text": "123456" } ]
},
{
"type": "button",
"sub_type": "url",
"index": "0",
"parameters": [ { "type": "text", "text": "123456" } ]
}
]
}
}
Catalog Template
Catalog Template
Send a product catalog template to showcase items.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "91xxxxxxxxxx",
"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"
}
}
]
}
]
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "91xxxxxxxxxx",
"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"
}
}
]
}
]
}
}
Text Message
Text Message
Simple free-form text messages (Session only).
preview_urlbooleanIf true, generates a preview for links.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "text",
"text": {
"preview_url": false,
"body": "Hello there!"
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "text",
"text": {
"preview_url": false,
"body": "Hello there!"
}
}
Text Reply (Context)
Text Reply
Reply to a specific message using its ID.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"context": {
"message_id": "wamid.HBgLMT..."
},
"type": "text",
"text": {
"preview_url": false,
"body": "This is a reply to your previous message."
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"context": {
"message_id": "wamid.HBgLMT..."
},
"type": "text",
"text": {
"preview_url": false,
"body": "This is a reply to your previous message."
}
}
Reaction Message
Reaction Message
React to a message with an emoji.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "reaction",
"reaction": {
"message_id": "wamid.HBgLMT...",
"emoji": "👍"
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "reaction",
"reaction": {
"message_id": "wamid.HBgLMT...",
"emoji": "👍"
}
}
Location Message
Location Message
Send a static location map pin.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "location",
"location": {
"latitude": "12.9716",
"longitude": "77.5946",
"name": "Avianya HQ",
"address": "Bangalore, India"
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "location",
"location": {
"latitude": "12.9716",
"longitude": "77.5946",
"name": "Avianya HQ",
"address": "Bangalore, India"
}
}
Contact Message
Contact Message
Share a contact card (vCard).
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "contacts",
"contacts": [
{
"name": {
"formatted_name": "John Doe",
"first_name": "John",
"last_name": "Doe"
},
"phones": [
{
"phone": "+919999999999",
"type": "WORK"
}
],
"emails": [
{
"email": "john@example.com",
"type": "WORK"
}
]
}
]
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "contacts",
"contacts": [
{
"name": {
"formatted_name": "John Doe",
"first_name": "John",
"last_name": "Doe"
},
"phones": [
{
"phone": "+919999999999",
"type": "WORK"
}
],
"emails": [
{
"email": "john@example.com",
"type": "WORK"
}
]
}
]
}
Image Message
Image Message
Send an image via URL. Supported formats: JPEG, PNG.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "image",
"image": {
"link": "https://example.com/pic.jpg",
"caption": "Check this out"
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "image",
"image": {
"link": "https://example.com/pic.jpg",
"caption": "Check this out"
}
}
Audio Message
Audio Message
Send an audio file. Supported formats: MP3, OGG, AMR.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "audio",
"audio": {
"link": "https://example.com/audio.mp3"
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "audio",
"audio": {
"link": "https://example.com/audio.mp3"
}
}
Video Message
Video Message
Send a video file. Supported formats: MP4, 3GP.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "video",
"video": {
"link": "https://example.com/video.mp4",
"caption": "Product Demo Video"
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "video",
"video": {
"link": "https://example.com/video.mp4",
"caption": "Product Demo Video"
}
}
Document Message
Document Message
Send a PDF or generic document.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "document",
"document": {
"link": "https://example.com/invoice.pdf",
"caption": "Your Invoice for Order #123"
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "document",
"document": {
"link": "https://example.com/invoice.pdf",
"caption": "Your Invoice for Order #123"
}
}
Sticker Message
Sticker Message
Send a static or animated sticker (WebP format).
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "sticker",
"sticker": {
"link": "https://example.com/sticker.webp"
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "sticker",
"sticker": {
"link": "https://example.com/sticker.webp"
}
}
List Message (Menu)
List Message
Send a menu of up to 10 options. Safer than buttons as they don't disappear on click.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "list",
"header": { "type": "text", "text": "Select an Option" },
"body": { "text": "Please choose a department to contact." },
"footer": { "text": "Avianya Support" },
"action": {
"button": "View Menu",
"sections": [
{
"title": "Sales",
"rows": [
{ "id": "sales_new", "title": "New Inquiry", "description": "Start a new project" }
]
},
{
"title": "Support",
"rows": [
{ "id": "support_tech", "title": "Tech Support", "description": "Fix an issue" }
]
}
]
}
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "list",
"header": { "type": "text", "text": "Select an Option" },
"body": { "text": "Please choose a department to contact." },
"footer": { "text": "Avianya Support" },
"action": {
"button": "View Menu",
"sections": [
{
"title": "Sales",
"rows": [
{ "id": "sales_new", "title": "New Inquiry", "description": "Start a new project" }
]
},
{
"title": "Support",
"rows": [
{ "id": "support_tech", "title": "Tech Support", "description": "Fix an issue" }
]
}
]
}
}
}
Reply Buttons
Reply Buttons
Send up to 3 quick reply buttons. Great for Yes/No questions.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "button",
"body": { "text": "Do you want to confirm your appointment?" },
"action": {
"buttons": [
{
"type": "reply",
"reply": { "id": "btn_yes_1", "title": "Yes" }
},
{
"type": "reply",
"reply": { "id": "btn_no_1", "title": "No" }
}
]
}
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "button",
"body": { "text": "Do you want to confirm your appointment?" },
"action": {
"buttons": [
{
"type": "reply",
"reply": { "id": "btn_yes_1", "title": "Yes" }
},
{
"type": "reply",
"reply": { "id": "btn_no_1", "title": "No" }
}
]
}
}
}
Carousel (URL Buttons)
Carousel with URL Buttons
Scrollable carousel of cards, each with a link button.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "carousel",
"body": { "text": "Check out these items:" },
"action": {
"cards": [
{
"card_index": 0,
"type": "cta_url",
"header": {
"type": "image",
"image": { "link": "https://example.com/img1.jpg" }
},
"body": { "text": "*Blue Echeveria*" },
"action": {
"name": "cta_url",
"parameters": {
"display_text": "Buy now",
"url": "https://shop.example.com/item1"
}
}
},
{
"card_index": 1,
"type": "cta_url",
"header": {
"type": "image",
"image": { "link": "https://example.com/img2.jpg" }
},
"body": { "text": "*Zebra Haworthia*" },
"action": {
"name": "cta_url",
"parameters": {
"display_text": "Buy now",
"url": "https://shop.example.com/item2"
}
}
}
]
}
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "carousel",
"body": { "text": "Check out these items:" },
"action": {
"cards": [
{
"card_index": 0,
"type": "cta_url",
"header": {
"type": "image",
"image": { "link": "https://example.com/img1.jpg" }
},
"body": { "text": "*Blue Echeveria*" },
"action": {
"name": "cta_url",
"parameters": {
"display_text": "Buy now",
"url": "https://shop.example.com/item1"
}
}
},
{
"card_index": 1,
"type": "cta_url",
"header": {
"type": "image",
"image": { "link": "https://example.com/img2.jpg" }
},
"body": { "text": "*Zebra Haworthia*" },
"action": {
"name": "cta_url",
"parameters": {
"display_text": "Buy now",
"url": "https://shop.example.com/item2"
}
}
}
]
}
}
}
Carousel (Quick Replies)
Carousel with Quick Replies
Carousel cards with actionable reply buttons.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "carousel",
"body": { "text": "Choose options for each item:" },
"action": {
"cards": [
{
"card_index": 0,
"type": "cta_url",
"header": {
"type": "image",
"image": { "link": "https://example.com/img1.jpg" }
},
"body": { "text": "*Blue Echeveria*" },
"action": {
"buttons": [
{
"type": "quick_reply",
"quick_reply": { "id": "btn_1", "title": "Buy" }
}
]
}
}
]
}
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "carousel",
"body": { "text": "Choose options for each item:" },
"action": {
"cards": [
{
"card_index": 0,
"type": "cta_url",
"header": {
"type": "image",
"image": { "link": "https://example.com/img1.jpg" }
},
"body": { "text": "*Blue Echeveria*" },
"action": {
"buttons": [
{
"type": "quick_reply",
"quick_reply": { "id": "btn_1", "title": "Buy" }
}
]
}
}
]
}
}
}
Product Carousel
Product Carousel
Scrollable carousel of products from your Catalog.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "carousel",
"body": { "text": "Check out our featured products!" },
"action": {
"cards": [
{
"card_index": 0,
"type": "product",
"action": {
"product_retailer_id": "item_1",
"catalog_id": "123456789"
}
},
{
"card_index": 1,
"type": "product",
"action": {
"product_retailer_id": "item_2",
"catalog_id": "123456789"
}
}
]
}
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "carousel",
"body": { "text": "Check out our featured products!" },
"action": {
"cards": [
{
"card_index": 0,
"type": "product",
"action": {
"product_retailer_id": "item_1",
"catalog_id": "123456789"
}
},
{
"card_index": 1,
"type": "product",
"action": {
"product_retailer_id": "item_2",
"catalog_id": "123456789"
}
}
]
}
}
}
Single Product
Single Product Message
Send a detailed view of a single product.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "product",
"body": { "text": "Check out this item!" },
"action": {
"catalog_id": "123456",
"product_retailer_id": "product_sku_123"
}
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "product",
"body": { "text": "Check out this item!" },
"action": {
"catalog_id": "123456",
"product_retailer_id": "product_sku_123"
}
}
}
Multi-Product List
Multi-Product List
Send a curated list of up to 30 products organised in sections.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "product_list",
"header": { "type": "text", "text": "Our Best Sellers" },
"body": { "text": "Select items to view details." },
"action": {
"catalog_id": "123456",
"sections": [
{
"title": "Summer Collection",
"product_items": [
{ "product_retailer_id": "SKU_1" },
{ "product_retailer_id": "SKU_2" }
]
}
]
}
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "product_list",
"header": { "type": "text", "text": "Our Best Sellers" },
"body": { "text": "Select items to view details." },
"action": {
"catalog_id": "123456",
"sections": [
{
"title": "Summer Collection",
"product_items": [
{ "product_retailer_id": "SKU_1" },
{ "product_retailer_id": "SKU_2" }
]
}
]
}
}
}
Catalog Message
Catalog Message
Send the entire storefront/catalog.
cURL Example
curl -X POST https://api.avianya.com/wa/partner/v1/{phone_number_id}/messages \
-H "Authorization: Bearer <YOUR_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "catalog_message",
"body": { "text": "Hello! Check out our latest collection." },
"action": {
"name": "catalog_message",
"parameters": {
"thumbnail_product_retailer_id": "product_sku_123"
}
}
}
}'
JSON Body
{
"messaging_product": "whatsapp",
"to": "91xxxxxxxxxx",
"type": "interactive",
"interactive": {
"type": "catalog_message",
"body": { "text": "Hello! Check out our latest collection." },
"action": {
"name": "catalog_message",
"parameters": {
"thumbnail_product_retailer_id": "product_sku_123"
}
}
}
}