Skip to main content
POST
/
instances
/
{instanceId}
/
token
/
{token}
/
send-button-actions
Send action buttons
curl --request POST \
  --url https://api.z-api.io/instances/{instanceId}/token/{token}/send-button-actions \
  --header 'Client-Token: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "phone": "<string>",
  "message": "<string>",
  "buttonActions": [
    {
      "id": "<string>",
      "type": "<string>",
      "label": "<string>",
      "phone": "<string>",
      "url": "<string>"
    }
  ]
}
'

Overview

With this method you can send text messages with action buttons that redirect to links, initiate calls, or provide standard responses.
Button sending is currently available, but there are some decisive factors for it to work. Check the button status topic for more information.
ATTENTIONSending all three button types simultaneously causes an error on WhatsApp Web. Combine CALL and URL buttons together, and send REPLY buttons separately.

Attributes

instanceId
string
required
Your instance ID. Available in the Z-API panel under Instances.
token
string
required
Your Z-API instance token.

Required

phone
string
required
Recipient’s phone number (or group ID for group messages) in DDI DDD NUMBER format. E.g.: 551199999999
message
string
required
Message text
buttonActions
array
required
Array of action buttons

Optional

title
string
Message title
Message footer

Request Body

CALL and URL buttons (together):
{
  "phone": "551199999999",
  "message": "a message",
  "title": "if you want to add a title",
  "footer": "if you want to add a footer",
  "buttonActions": [
    {
      "id": "1",
      "type": "CALL",
      "phone": "554498398733",
      "label": "Contact us"
    },
    {
      "id": "2",
      "type": "URL",
      "url": "https://z-api.io",
      "label": "Visit our website"
    }
  ]
}
REPLY button (separate):
{
  "phone": "551199999999",
  "message": "a message",
  "title": "if you want to add a title",
  "footer": "if you want to add a footer",
  "buttonActions": [
    {
      "id": "3",
      "type": "REPLY",
      "label": "Talk to an agent"
    }
  ]
}

Response

200

{
  "zaapId": "3999984263738042930CD6ECDE9VDWSA",
  "messageId": "D241XXXX732339502B68",
  "id": "D241XXXX732339502B68"
}

405

Make sure you are correctly sending the method specification, that is, verify that you sent POST or GET as specified at the beginning of this topic.

415

If you receive a 415 error, make sure to add the “Content-Type” header to your request, which in most cases is “application/json”.