Skip to content

Interactive Messages

Convers8 allows you to send interactive messages to your WhatsApp contacts, including list messages and reply buttons. This guide covers how to use the interactive messaging API.

Authentication

All API requests must include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Base URL

https://waba-v1.convers8.africa

Interactive Message Types

Convers8 supports the following interactive message types:

  • List Messages: Messages with a list of selectable options
  • Reply Buttons: Messages with up to 3 quick reply buttons

Sending List Messages

List messages allow you to present a menu of options to your customers.

Endpoint

POST /whatsapp/message/interactive-list

Request Body

PropertyTypeDescription
tostringThe recipient's phone number in international format
namestringThe recipient's name
contentobjectAn object containing the message content
content.headerstring(Optional) The header text
content.bodystringThe main message text
content.footerstring(Optional) The footer text
content.actionobjectThe action object containing the button and sections
content.action.buttonstringThe text for the main button
content.action.sectionsarrayAn array of section objects

Each section object has the following properties:

PropertyTypeDescription
titlestringThe title of the section
rowsarrayAn array of row objects

Each row object has the following properties:

PropertyTypeDescription
idstringA unique identifier for the row
titlestringThe title of the row
descriptionstring(Optional) A description for the row

Example Request

json
{
  "to": "+1234567890",
  "name": "Customer Name",
  "content": {
    "header": "Menu Options",
    "body": "Please select an option from the list below",
    "footer": "Powered by Convers8",
    "action": {
      "button": "View Options",
      "sections": [
        {
          "title": "Services",
          "rows": [
            {
              "id": "service_1",
              "title": "Customer Support",
              "description": "Get help from our team"
            },
            {
              "id": "service_2",
              "title": "Sales Inquiry",
              "description": "Talk to our sales team"
            }
          ]
        },
        {
          "title": "Products",
          "rows": [
            {
              "id": "product_1",
              "title": "Product Catalog",
              "description": "Browse our products"
            },
            {
              "id": "product_2",
              "title": "New Arrivals",
              "description": "See what's new"
            }
          ]
        }
      ]
    }
  }
}

cURL Example

bash
curl --request POST \
     --url https://waba-v1.convers8.africa/whatsapp/message/interactive-list \
     --header 'Authorization: Bearer YOUR_API_KEY' \
     --header 'Content-Type: application/json' \
     --data '{
       "to": "+1234567890",
       "name": "Customer Name",
       "content": {
         "header": "Menu Options",
         "body": "Please select an option from the list below",
         "footer": "Powered by Convers8",
         "action": {
           "button": "View Options",
           "sections": [
             {
               "title": "Services",
               "rows": [
                 {
                   "id": "service_1",
                   "title": "Customer Support",
                   "description": "Get help from our team"
                 },
                 {
                   "id": "service_2",
                   "title": "Sales Inquiry",
                   "description": "Talk to our sales team"
                 }
               ]
             }
           ]
         }
       }
     }'

Sending Reply Button Messages

Reply button messages allow you to present up to 3 quick reply buttons to your customers.

Endpoint

POST /whatsapp/message/interactive-reply

Request Body

PropertyTypeDescription
tostringThe recipient's phone number in international format
namestringThe recipient's name
contentobjectAn object containing the message content
content.typestringMust be "button"
content.headerobject(Optional) The header object
content.bodyobjectThe body object
content.actionobjectThe action object containing the buttons

The header object has the following properties:

PropertyTypeDescription
typestringThe type of header (e.g., "text")
textstringThe header text

The body object has the following properties:

PropertyTypeDescription
textstringThe main message text

The action object has the following properties:

PropertyTypeDescription
buttonsarrayAn array of button objects (maximum 3)

Each button object has the following properties:

PropertyTypeDescription
typestringMust be "reply"
replyobjectThe reply object

The reply object has the following properties:

PropertyTypeDescription
idstringA unique identifier for the button
titlestringThe button text

Example Request

json
{
  "to": "+1234567890",
  "name": "Customer Name",
  "content": {
    "type": "button",
    "header": {
      "type": "text",
      "text": "Feedback Request"
    },
    "body": {
      "text": "How would you rate our service?"
    },
    "action": {
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "id": "rating_good",
            "title": "Good"
          }
        },
        {
          "type": "reply",
          "reply": {
            "id": "rating_average",
            "title": "Average"
          }
        },
        {
          "type": "reply",
          "reply": {
            "id": "rating_poor",
            "title": "Poor"
          }
        }
      ]
    }
  }
}

cURL Example

bash
curl --request POST \
     --url https://waba-v1.convers8.africa/whatsapp/message/interactive-reply \
     --header 'Authorization: Bearer YOUR_API_KEY' \
     --header 'Content-Type: application/json' \
     --data '{
       "to": "+1234567890",
       "name": "Customer Name",
       "content": {
         "type": "button",
         "header": {
           "type": "text",
           "text": "Feedback Request"
         },
         "body": {
           "text": "How would you rate our service?"
         },
         "action": {
           "buttons": [
             {
               "type": "reply",
               "reply": {
                 "id": "rating_good",
                 "title": "Good"
               }
             },
             {
               "type": "reply",
               "reply": {
                 "id": "rating_average",
                 "title": "Average"
               }
             },
             {
               "type": "reply",
               "reply": {
                 "id": "rating_poor",
                 "title": "Poor"
               }
             }
           ]
         }
       }
     }'

Response Format

All API endpoints return a JSON response with the following structure:

json
{
  "success": true,
  "message": "Message sent successfully",
  "data": {
    "messageId": "wamid.abcdefghijklmnopqrstuvwxyz"
  }
}

Error Handling

In case of an error, the response will look like:

json
{
  "success": false,
  "message": "Error message",
  "error": {
    "code": "error_code",
    "details": "Error details"
  }
}

Common error codes include:

  • invalid_parameter: One or more parameters in the request are invalid
  • unauthorized: Invalid or missing API key
  • rate_limit_exceeded: Too many requests in a short period
  • interactive_message_invalid: The interactive message structure is invalid

Limitations

  • List messages can have a maximum of 10 sections
  • Each section can have a maximum of 10 rows
  • Reply button messages can have a maximum of 3 buttons
  • Button titles are limited to 20 characters
  • The body text is limited to 1024 characters

Best Practices

  1. Keep it Simple: Use clear, concise options that are easy to understand.
  2. Button Text: Keep button text short and descriptive.
  3. User Experience: Design interactive messages with the user experience in mind.
  4. Error Handling: Implement proper error handling to manage API errors gracefully.
  5. Testing: Test your interactive messages on different devices to ensure they display correctly.