---
agentTools:
  projectIndex: https://rampwin-api.readme.io/llms.txt
---

# Send WhatsApp Interactive Button Message

Sends a WhatsApp interactive message with reply buttons, allowing users to quickly respond by tapping options.

## Prerequisite (Media Flow for Header)

If you are using an **image header**, you must first generate a **public media URL**.

### Step 1 — Upload Media

```curl cURL
curl --location 'https://api.rampwin.com/api/media/upload' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'file=@"/path/to/file.png"'
```

### Response

```json JSON
{
  "success": true,
  "url": "https://your-bucket.s3.region.amazonaws.com/uploads/file.png"
}
```

***

### Step 2 — Use URL in Interactive Message

Use the returned `url` in:

```json
"header": {
  "type": "image",
  "image": {
    "link": "PUBLIC_IMAGE_URL"
  }
}
```

***

## Endpoint

`POST /api/messages/send`

**Base URL**

```bash URL
https://api.rampwin.com
```

***

## Query Parameters

| Parameter          | Type    | Required | Description                                  |
| ------------------ | ------- | -------- | -------------------------------------------- |
| dontShowInChatList | boolean | No       | Hide message from chat list (default: false) |

***

## Headers

| Header       | Type   | Required | Description          |
| ------------ | ------ | -------- | -------------------- |
| X-API-Key    | string | Yes      | Your Rampwin API key |
| Content-Type | string | Yes      | application/json     |
| Cookie       | string | Yes      | AWS session cookie   |

***

## Request Body

```json JSON
{
  "channel_id": "CHANNEL_ID",
  "phone_number": "PHONE_NUMBER",
  "hide_from_chat": false,
  "interactive": {
    "type": "button",
    "body": {
      "text": "Hello how are you"
    },
    "action": {
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "id": "button_1",
            "title": "Buy Now"
          }
        }
      ]
    },
    "header": {
      "type": "image",
      "image": {
        "link": "PUBLIC_IMAGE_URL"
      }
    },
    "footer": {
      "text": "Thank You"
    }
  }
}
```

***

## Request Parameters

| Field            | Type    | Required | Description                                |
| ---------------- | ------- | -------- | ------------------------------------------ |
| channel\_id      | string  | Yes      | WhatsApp channel ID                        |
| phone\_number    | string  | Yes      | Recipient phone number (with country code) |
| hide\_from\_chat | boolean | No       | Hide message in chat UI                    |
| interactive      | object  | Yes      | Interactive message object                 |

***

## Example Request

```curl cURL
curl --location 'https://api.rampwin.com/api/messages/send?dontShowInChatList=false' \
--header 'X-API-Key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
  "channel_id": "YOUR_CHANNEL_ID",
  "phone_number": "919999999999",
  "hide_from_chat": false,
  "interactive": {
    "type": "button",
    "body": {
      "text": "Hello how are you"
    },
    "action": {
      "buttons": [
        {
          "type": "reply",
          "reply": {
            "id": "btn_1",
            "title": "Buy Now"
          }
        }
      ]
    },
    "header": {
      "type": "image",
      "image": {
        "link": "https://your-bucket.s3.region.amazonaws.com/uploads/file.png"
      }
    },
    "footer": {
      "text": "Thank You"
    }
  }
}'
```

***

## Response

### Success (200)

```json JSON
{
  "success": true,
  "message": "Interactive message sent successfully"
}
```

***

### Error (400)

```json JSON
{
  "success": false,
  "message": "Invalid interactive payload"
}
```

***

## Common Errors

| Error             | Description               |
| ----------------- | ------------------------- |
| Invalid buttons   | Wrong button structure    |
| Missing body text | Body text required        |
| Invalid media URL | Image link not accessible |
| Unauthorized      | Invalid API key           |