# Interactive Messages

Interactive messages give your users a simpler way to find and select what they want from your business on WhatsApp. During testing, chatbots using interactive messaging features achieved significantly higher response rates and conversions compared to those that are text-based.

Types of interactive messages:

* **List Messages**: Messages including a menu of up to 10 options. This type of message offers a simpler and more consistent way for users to make a selection when interacting with a business.
* **Reply Button Messages**: Messages including up to 3 options —each option is a button. This type of message offers a quicker way for users to make a selection from a menu when interacting with a business. Reply buttons have the same user experience as interactive templates with buttons.

{% hint style="info" %}
Currently, they can only be sent within 24 hours of the last message sent by the user. If you try to send a message outside the 24-hour window, you get an error message.

Supported platforms: iOS, Android, and web.
{% endhint %}

<figure><img src="https://1071456698-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2tt1HFPYu3MFeBO1zix4%2Fuploads%2FdArAf6G2wDlbhCGbFUap%2Finteractive.png?alt=media&#x26;token=67034736-974a-45e9-8fa2-902700d4526c" alt=""><figcaption></figcaption></figure>

#### When You Should Use It <a href="#when-you-should-use-it" id="when-you-should-use-it"></a>

List Messages are best for presenting several options, such as:

* A customer care or FAQ menu
* A take-out menu
* Selection of nearby stores or locations
* Available reservation times
* Choosing a recent order to repeat

Reply Buttons are best for offering quick responses from a limited set of options, such as:

* Airtime recharge
* Changing personal details
* Reordering a previous order
* Requesting a return
* Adding optional extras to a food order
* Choosing a payment method

Reply buttons are particularly valuable for ‘personalized’ use cases where a generic response is not adequate.

```json
{
  "to_contact" : "+918080808080",
  "type": "interactive" 
  "interactive":{
    "type": "list" | "button",
    "header": {},
    "body": {},
    "footer": {},
    "action": {}
  }
}
```

## Sending an Interactive Message

<mark style="color:green;">`POST`</mark> `https://api.qikchat.in/v1/messages`

To send an interactive message, use the request URL and the following body parameters.

#### Request Body

| Name                                          | Type   | Description                                       |
| --------------------------------------------- | ------ | ------------------------------------------------- |
| to\_contact<mark style="color:red;">\*</mark> | string | customer whatsapp number you want to send message |
| type<mark style="color:red;">\*</mark>        | string | interactive                                       |
| interactive<mark style="color:red;">\*</mark> | object | contains interactive fields                       |

{% tabs %}
{% tab title="200: OK " %}
A successful response includes a data object with an ID for the message sent.

```json
{
    "status": true,
    "message": "Messages queued successfully",
    "data": [
        {
            "id": "52JH6WmuSruAVyXvBBYemd0Ia",
            "channel": "whatsapp",
            "from": "919099999916",
            "recipient": "+918080808080",
            "created_at": "2023-02-19T12:52:25.222Z",
            "status": "queued"
        }
    ]
}
```
{% endtab %}
{% endtabs %}

#### Request Example

```json
{
    "to_contact": "+918080808080",
    "type": "interactive",
    "interactive": {
        "type": "button",
        "header": {
            "type": "image",
            "image": {
                "link": "https://petapixel.com/assets/uploads/2017/03/product1.jpeg"
            }
        },
        "body": {
            "text": "Core Black / Brown / Core Black"
        },
        "footer": {
            "text": "28 people have bought this item in the last 24 hours."
        },
        "action": {
            "buttons": [
                {
                    "type": "reply",
                    "reply": {
                        "id": "buy_now",
                        "title": "Buy Now"
                    }
                },
                {
                    "type": "reply",
                    "reply": {
                        "id": "see_sizes",
                        "title": "See available sizes"
                    }
                },
                {
                    "type": "reply",
                    "reply": {
                        "id": "agent",
                        "title": "Talk to an Agent"
                    }
                }
            ]
        }
    }
}
```

By the end, your `interactive` object for button should look something like this:

```json
"interactive": {
    "type": "button",
    "header": { # optional
      "type": "text" | "image" | "video" | "document",
      "text": "your text"
      # OR
      "document": {
        "link": "http(s)://the-url",
        "filename": "some-file-name"
      },
      # OR
      "video": {
        "link": "http(s)://the-url"
      }
      # OR
      "image": {
        "link": "http(s)://the-url"
      }
    }, # end header
    "body": {
      "text": "your-text-body-content"
    },
    "footer": { # optional
      "text": "your-text-footer-content"
    },
    "action": {
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "id": "unique-postback-id",
            "title": "First Button’s Title" 
          }
        },
        {
          "type": "reply",
          "reply": {
            "id": "unique-postback-id",
            "title": "Second Button’s Title" 
          }
        }
      ] 
    } # end action   
  } # end interactive
```

By the end, your `interactive` object for list should look something like this:

```json
"interactive": {
    "type": "list",
    "header": { # optional
      "type": "text",
      "text": "your text"
    }, # end header
    "body": {
        "text": "your-text-body-content"
    },
    "footer": { # optional
      "text": "your-text-footer-content"
    },
    "action": {
        "button": "Select",
        "sections": [
            {
                "title": "Menu",
                "rows": [
                    {
                        "id": "location",
                        "title": "📍 Location",
                        "description": ""
                    },
                    {
                        "id": "gold-rate",
                        "title": "₹ Today's Rate",
                        "description": ""
                    }
                ]
            }
        ]
    } # end action
} # end interactive
```
