Sending interactive Messages
Use this api to send interactive messages.
API_TOKEN
Developers can authenticate their API calls with the API_TOKEN
generated in App Dashboard > Phone Numbers > Detail > Api
. To send a interactive message, make a POST
call to /messages
and attach a message object with type=interactive
.
Parameters
This is the main parameter used in send interactive message requests:
Name | Description |
---|---|
to | Required WhatsApp ID or phone number for the person you want to send a message to. The phone numbers in this requests can be provided in any dialable format, as long as they include their country code. It's recommended that you explicitly prefix the country code with a plus sign (+). Here are some examples of supported phone number formats:
|
reply_message_id | Optional You can send any message as a reply to a previous message in a conversation by including the previous message's ID. The recipient will receive the new message along with a contextual bubble that displays the previous message's content. |
type | Required The type of message you want to send. Set this as individual interactive . |
interactive | Required A interactive object. |
interactive.type | Required Describes the interactive type. Supported values:
|
interactive.header | Optional Required when interactive.type=product_list.Header content displayed on top of a message. You cannot set a header if your interactive object is of product type. |
interactive.header.type | Optional The header type you would like to use. Supported values:
|
interactive.header.text | Optional Required when type=text.The message’s text |
interactive.header.image | Optional Required when type=image.Header content displayed on top of a message. You cannot set a header if your interactive object is of product type. |
interactive.header.image.id | Optional Required when you are not using a link.The media object ID. |
interactive.header.image.link | Optional Required when you are not using an uploaded media ID.The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. |
interactive.header.image.caption | Optional Describes the specified image |
interactive.header.video | Optional Required when type=video.A media object of type video. |
interactive.header.video.id | Optional Required when you are not using a link.when you are not using a link. |
interactive.header.video.link | Optional Required when you are not using an uploaded media ID.The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. |
interactive.header.video.caption | Optional Describes the specified video. |
interactive.header.document | Optional Required when type=document.A media object of type document. |
interactive.header.document.link | Optional Required when you are not using an uploaded media ID.The protocol and URL of the media to be sent. Use only with HTTP/HTTPS URLs. |
interactive.header.document.caption | Optional Describes the specified document. |
interactive.header.document.filename | Optional Describes the filename for the specific document. |
interactive.body | Required The content of the message. Emojis and markdown are supported. Maximum length: 1024 characters. |
interactive.footer | Optional The footer content. Emojis, markdown, and links are supported. Maximum length: 60 characters. |
interactive.action | Required Action you want the user to perform after reading the message. |
interactive.action.title | Optional Required when interactive.type=list.Button content. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters. |
interactive.action.list | Optional Required when interactive.type=list.Array of list objects. There is a minimum of 1 and maximum of 10. |
interactive.action.list.*.id | Optional Unique identifier for your button. This ID is returned in the webhook when the button is clicked by the user. Maximum length: 256 characters. |
interactive.action.list.*.title | Optional Button title. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters. |
interactive.action.list.*.description | Optional Button description. Maximum length: 72 characters. |
interactive.action.button | Optional Required when interactive.type=button.Array of button objects. You can have up to 3 buttons. You cannot have leading or trailing spaces when setting the ID. |
interactive.action.button.*.id | Optional Unique identifier for your button. This ID is returned in the webhook when the button is clicked by the user. Maximum length: 256 characters. |
interactive.action.button.*.title | Optional Button title. It cannot be an empty string and must be unique within the message. Emojis are supported, markdown is not. Maximum length: 20 characters. |
interactive.action.catalog | Optional Required when interactive.type=catalog_message/product/product_list.Catalog object |
interactive.action.catalog.id | Optional Required when interactive.type=product/product_list.Unique identifier of the Facebook catalog linked to your WhatsApp Business Account. |
interactive.action.catalog.product | Optional Required when interactive.type=product. |
interactive.action.catalog.product.id | Optional Required when interactive.type=product.Unique identifier of the product in a catalog. |
interactive.action.catalog.products | Optional Required when interactive.type=product_list.Array of list objects. There is a minimum of 1 and maximum of 10. |
interactive.action.catalog.products.*.title | Optional Required when interactive.type=product_list.Title for your catalog products. There is maximum 24 characters. |
interactive.action.catalog.products.*.product_items | Optional Required when interactive.type=product_list.Array of product items object. There is a minimum of 1 and maximum of 30. |
interactive.action.catalog.products.*.product_items*.id | Optional Required when interactive.type=product_list.Unique identifier of the product in a catalog. |
Example
Sample request:
curl -X POST 'https://waofficial.botika.online/api/whatsapp/v1/messages' \ -H 'Authorization: Bearer {{ API_TOKEN }}' \ -H 'Content-Type: application/json' \ -d '{ "to": "+62821xxxxxx", "reply_message_id": "{{ MESSAGE_ID }}", "type": "interactive", "interactive": { "type": "list" | "button" | "product" | "product_list", "header": { "type": "text" | "image" | "video" | "document", "text": "your text", # OR "document": { "id": "your-media-id", # OR "link": "http(s)://document-url" "filename": "some-file-name" } # OR "video": { "id": "your-media-id", # OR "link": "http(s)://video-url" } # OR "image": { "id": "your-media-id", # OR "link": "http(s)://image-url", } }, "body": "your-text-message-content-here", "footer": "your-footer-content-here", "action": { # list type "title": "cta-button-content-here", "list": [ { "id": "unique-button-identifier-here", "title": "button-title-content-here", "description": "button-description-content-here", }, ... ] # button type "button": [ { "id": "unique-button-identifier-here", "title": "button-title-content-here", }, ... ] # product , product_list or catalog_message type "catalog": { "id": "your-catalog-id", # product type "product": { "id": "your-product-content-id" }, # product_list type "products": [ { "title": "title-of-the-section", "product_items" : [ { "id": "your-product-content-id" }, { "id": "your-product-content-id" } ... ] }, ... ] } }, } }'
A successful response includes an object with an identifier for the message:
{ "data": { "id": "{{ MESSAGE_ID }}" } }