# Enviar mensagem com botões

### Um pouco sobre botões

Neste método você poderá enviar mensagens de texto com botões de ação, o conteúdo do botão poderão ser escolhidos pelo usuário e será utilizado como resposta da mensagem enviada junto com os botões.

<figure><img src="/files/MApFyrB9wXDtrYYP0NbB" alt=""><figcaption></figcaption></figure>

### Exemplo de body a ser enviado:

```json
{
  "footer": "Não compartilhamos nada.",
  "text": "O que você está achando de usar a Zapfy?",
  "destination": "+55 61 9551-4650",
  "buttons": [
    {
      "id": "0",
      "body": "Muuito bom.",
      "type": "text"
    },
    {
      "id": "1",
      "body": "Excelente.",
      "type": "text"
    },
    {
      "id": 2,
      "body": "Quero ver o site"
    },
    {
      "id": 3,
      "body": "Quero ligar"
    }
  ]
}
```

###

## Enviar uma mensagem de botões com texto

<mark style="color:green;">`POST`</mark> `https://api.zapfy.me/v1/instance/{{instanceKey}}/token/{{instanceToken}}/message?type=buttons`

Permite enviar uma mensagem de botões via rest para um contato no WhatsApp, note que essa mensagem será adicionada à uma fila e no momento da requisição será devolvido um `id` de identificação dessa mensagem, essa fila irá processar o envio da mensagem e depois irá chamar o `webhook`de delivery da instância que enviou a mensagem.

Após o envio, você receberá um webhook no método post na url da sua instância, veja a página de webhooks que temos aqui na documentação para melhor entendimento do que será enviado:

[Webhooks](/webhooks/envio-recebimento-de-mensagens.md)

#### Path Parameters

| Name                                            | Type   | Description |
| ----------------------------------------------- | ------ | ----------- |
| instanceKey<mark style="color:red;">\*</mark>   | String |             |
| instanceToken<mark style="color:red;">\*</mark> | String |             |

#### Query Parameters

| Name                                   | Type   | Description                                    |
| -------------------------------------- | ------ | ---------------------------------------------- |
| type<mark style="color:red;">\*</mark> | String | Para envio de botões, valor deve ser `buttons` |

#### Request Body

| Name                                          | Type      | Description                                                                                                                            |
| --------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| text<mark style="color:red;">\*</mark>        | String    | Texto a ser enviado                                                                                                                    |
| destination<mark style="color:red;">\*</mark> | String    | <p>Número de telefone do usuário ou id de um grupo.</p><p><br>Exemplo: (556195514650)</p><p></p><p>Necessário conter DD e DDI.<br></p> |
| footer                                        | String    | Texto que aparecerá no footer da mensagem                                                                                              |
| buttons<mark style="color:red;">\*</mark>     | Button\[] | Array contendo botões                                                                                                                  |

{% tabs %}
{% tab title="200: OK Message scheduled" %}

```javascript
{
    "result": {
        "id": "c67fad44-c6eb-4ba2-9f4e-ddc5b526dbe9"
    },
    "message": "MESSAGE_SCHEDULED",
    "isValid": true
}
```

{% endtab %}
{% endtabs %}

### Webhooks disparados após o envio

O envio dessa mensagem resultará em webhooks do tipo [Envio de buttons message](/webhooks/envio-recebimento-de-mensagens/envio-de-buttons-message.md) e [Alteração de status da mensagem](/webhooks/envio-recebimento-de-mensagens/alteracao-de-status-da-mensagem.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zapfy.me/integrando-com-a-api/messages/enviar-mensagem-com-botoes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
