# Enviar mensagem de documento

### Um pouco sobre mensagens de documentos

Neste método você poderá enviar mensagens com documentos.

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

### Exemplo de body a ser enviado:

O parâmetro `base64` pode ser uma base64 text ou uma url para o documento.

```json
{
    "destination": "+55 61 9551-4650",
    "text": "Uma mensagem de pdf direto da Zapfy :)",
    "base64": "https://www.africau.edu/images/default/sample.pdf",
    "fileName": "sample-pdf"
}
```

## Enviar uma mensagem de documento

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

Permite enviar uma mensagem de documento 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 `audio` |

#### Request Body

| Name                                          | Type   | Description                                                                                                                            |
| --------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- |
| 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> |
| base64<mark style="color:red;">\*</mark>      | String | Base64 do documento ou url para o documento                                                                                            |
| text                                          | String | Texto para a mensagem                                                                                                                  |
| fileName<mark style="color:red;">\*</mark>    | String | Nome do documento a ser exibido                                                                                                        |

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

```javascript
{
    "result": {
        "id": "0d5f9971-7dbd-4ecb-b82f-ab097d7ea5d8"
    },
    "message": "MESSAGE_SCHEDULED",
    "isValid": true
}
```

{% endtab %}
{% endtabs %}

### Webhooks disparados após o envio

O envio dessa mensagem resultará em webhooks do tipo [Envio de document message](/webhooks/envio-recebimento-de-mensagens/envio-de-document-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-de-documento.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.
