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 --location 'https://api.rampwin.com/api/media/upload' \
--header 'x-api-key: YOUR_API_KEY' \
--form 'file=@"/path/to/file.png"'

Response

{
  "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:

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

Endpoint

POST /api/messages/send

Base URL

https://api.rampwin.com

Query Parameters

ParameterTypeRequiredDescription
dontShowInChatListbooleanNoHide message from chat list (default: false)

Headers

HeaderTypeRequiredDescription
X-API-KeystringYesYour Rampwin API key
Content-TypestringYesapplication/json
CookiestringYesAWS session cookie

Request Body

{
  "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

FieldTypeRequiredDescription
channel_idstringYesWhatsApp channel ID
phone_numberstringYesRecipient phone number (with country code)
hide_from_chatbooleanNoHide message in chat UI
interactiveobjectYesInteractive message object

Example Request

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)

{
  "success": true,
  "message": "Interactive message sent successfully"
}

Error (400)

{
  "success": false,
  "message": "Invalid interactive payload"
}

Common Errors

ErrorDescription
Invalid buttonsWrong button structure
Missing body textBody text required
Invalid media URLImage link not accessible
UnauthorizedInvalid API key