| Parameter | Type | Description | Constraints |
|---|---|---|---|
from | string | The sender's phone number (or ID) from which the message will be sent. | Required. Pattern: ^[1-9][0-9]{0,3}[1-9][0-9]{9}$ Max Length: 15 characters. |
to | string | The recipient's phone number (or ID) to whom the message will be sent. | Required. Pattern: ^[1-9][0-9]{0,3}[1-9][0-9]{9}$ Max Length: 15 characters. |
type | string | Specifies the type of message. For interactive messages, this should be "interactive". | Required. Default: "interactive" |
interactive | object | Contains the details of the interactive message. | Required. |
interactive Object Properties:| Parameter | Type | Description | Constraints |
|---|---|---|---|
type | string | Specifies the type of interactive message. For this structure, it must be "button". | Required. Default: "button" |
header | object | Optional. The header component of the interactive message. It can be of type text, image, video, or document. A header can only contain one of these types at a time. - If type is text, include a text field with the header content. - If type is image, video, or document, include an object with the respective media type key (image, video, or document), which must contain either an id (media ID from Meta) or a link (URL to the media file). You cannot provide both id and link simultaneously. | Max for text header: 60 characters. Media headers: Either id or link is required within the media object, not both. Supported media types: image, video, document. Audio is not supported for header media in this structure. |
body | object | Contains the main content of the message. This is a crucial part of your interactive message. | Required. |
footer | object | Optional. The footer component of the interactive message. It can contain a text field. Set to null if no footer is desired. | Max for text footer: 60 characters. Can be null. |
action | object | Defines the interactive elements for the message, specifically the buttons. | Required. |
body Object Properties:| Parameter | Type | Description | Constraints |
|---|---|---|---|
text | string | The main message content to be displayed. | Required. Max Length: 1024 characters. |
footer Object Properties:| Parameter | Type | Description | Constraints |
|---|---|---|---|
text | string | The footer text for the message. | Max Length: 60 characters. Can be null. |
action Object Properties:| Parameter | Type | Description | Constraints |
|---|---|---|---|
buttons | array | An array of quick reply button objects. | Required. Maximum of 3 button objects allowed. |
buttons Array Item Properties:buttons array represents a single quick reply button.| Parameter | Type | Description | Constraints |
|---|---|---|---|
type | string | Specifies the type of button. For quick reply buttons, it's "reply". | Required. Default: "reply" |
reply | object | Contains the details of the quick reply button. | Required. |
reply Object Properties:| Parameter | Type | Description | Constraints |
|---|---|---|---|
id | string | A unique identifier for the button. This ID is sent back to your webhook when the user taps the button. | Required. Max Length: 256 characters. Must be unique across buttons in the message. |
title | string | The text displayed on the button to the user. | Required. Max Length: 20 characters. Must be unique across buttons in the message. |
header object within the interactive message."header": {
"type": "text",
"text": "<YOUR_HEADER_TEXT_HERE>"
}id or link."header": {
"type": "image",
"image": {
"id": "YOUR_MEDIA_ID"
// OR "link": "https://your-image-link.jpg"
}
}id or link."header": {
"type": "video",
"video": {
"id": "YOUR_MEDIA_ID"
// OR "link": "https://your-video-link.mp4"
}
}id or link."header": {
"type": "document",
"document": {
"id": "YOUR_MEDIA_ID"
// OR "link": "https://your-document-link.pdf"
}
}{
"from": "12345678901",
"to": "19876543210",
"type": "interactive",
"interactive": {
"type": "button",
"header": {
"type": "image",
"image": {
"id": "2762702990552401"
// OR "link": "https://example.com/promo_banner.png"
}
},
"body": {
"text": "Hello, our new collection has arrived! Explore exciting new items and special offers. Don't miss out on limited-time discounts for our valued customers. Check out our latest arrivals now!"
},
"footer": {
"text": "Offers valid while stocks last."
},
"action": {
"buttons": [
{
"type": "reply",
"reply": {
"id": "VIEW_COLLECTION_BTN",
"title": "View Collection"
}
},
{
"type": "reply",
"reply": {
"id": "CONTACT_SUPPORT_BTN",
"title": "Contact Support"
}
},
{
"type": "reply",
"reply": {
"id": "FAQS_BTN",
"title": "FAQs"
}
}
]
}
}
}{
"from": "12345678901",
"to": "19876543210",
"type": "interactive",
"interactive": {
"type": "button",
"header": {
"type": "text",
"text": "Upcoming Event Details"
},
"body": {
"text": "Join us for an insightful webinar on 'Future of AI'. Learn from industry leaders and engage in live Q&A sessions. Mark your calendars!"
},
"footer": {
"text": "Registration is free but spaces are limited."
},
"action": {
"buttons": [
{
"type": "reply",
"reply": {
"id": "REGISTER_WEBINAR_BTN",
"title": "Register Now"
}
}
]
}
}
}curl --location --request POST 'https://api.sendzen.io/v1/messages' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"from": "string",
"to": "string",
"type": "interactive",
"interactive": {
"type": "button",
"header": "string",
"body": {
"text": "string"
},
"footer": {
"text": "string"
},
"action": {
"buttons": [
{
"type": "reply",
"reply": {
"id": "string",
"title": "string"
}
}
]
}
}
}'{
"message_id": "string",
"status": "string",
"to": "string",
"timestamp": "string"
}