Messages

Send buttons or a list

POST/messages/interactiveScope messages:send

Sends a message the person answers by tapping: up to three reply buttons, or a list menu. Pass buttons or list, not both. Only works inside the 24-hour window.

Their choice comes back on the message.inbound webhook, with the id you gave the button or row in interactiveReplyId.

Body

  • tostringrequired

    Recipient phone number with country code, for example +919876543210. Spaces and dashes are ignored. A number without a country code is not guessed at and will not reach anyone.

  • fromstring

    Which of your WhatsApp numbers to send from. Accepts the number itself, its Meta phone_number_id or its Wamafy id. Defaults to your default number.

  • bodystringrequired

    Main text. Up to 1,024 characters.

  • headerstring

    Bold line above the body. Up to 60 characters.

  • footerstring

    Small grey line below. Up to 60 characters.

  • buttonsobject[]

    One to three reply buttons.

    • idstringrequired

      Your id for the button, returned when it is tapped.

    • titlestringrequired

      Button text. Up to 20 characters.

  • listobject

    A list menu, opened by a button.

    • buttonTextstringrequired

      Text on the button that opens the list. Up to 20 characters.

    • sectionsobject[]required

      One to ten sections, each with a title (optional, 24 characters) and rows: one to ten items with id, title (24 characters) and an optional description (72 characters).

Errors

StatusCodeWhen
400NO_OPEN_CONVERSATIONThe window is closed. Send a template instead.
422VALIDATION_ERRORBoth buttons and list were sent, or neither.

Plus the errors any endpoint can return, such as a missing key or scope. See Errors.

# macOS, Linux or Git Bash, with WAMAFY_API_KEY set. The quoting does not work in Windows cmd or PowerShell.
curl -X POST "https://api.wamafy.com/api/v1/public/messages/interactive" \
  -H "Authorization: Bearer $WAMAFY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "to": "+919876543210",
  "body": "When should we deliver?",
  "buttons": [
    {
      "id": "today",
      "title": "Today"
    },
    {
      "id": "tomorrow",
      "title": "Tomorrow"
    }
  ]
}'
Response 200
{
  "success": true,
  "data": {
    "messageId": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgSN0E",
    "conversationId": "2b7e4f10-8c3a-4d2e-b1f6-0a9c5e7d3b21",
    "status": "sent"
  }
}

Base URL https://api.wamafy.com/api/v1/public

    Send buttons or a list - Wamafy API