> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wapizap.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Enviando Mensagens

> Aprenda a enviar diferentes tipos de mensagens via WhatsApp

# Enviando Mensagens

Este guia mostra como enviar diferentes tipos de mensagens usando a Wapizap API.

## Pré-requisitos

Antes de enviar mensagens, você precisa:

1. Uma instância criada e conectada
2. Sua API Key configurada
3. O número do destinatário no formato internacional

## Formato do Número

<Warning>
  O número deve estar no formato internacional **sem símbolos**:
</Warning>

| Incorreto         | Correto       |
| ----------------- | ------------- |
| +55 11 99999-9999 | 5511999999999 |
| (11) 99999-9999   | 5511999999999 |

***

## Mensagem de Texto

O tipo mais simples de mensagem.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wapizap.com/api/v2/messages \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer SEU_TOKEN" \
    -d '{
      "instanceId": "sua-instancia",
      "to": "5511999999999",
      "type": "text",
      "text": "Olá! Como posso ajudar?"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.wapizap.com/api/v2/messages', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer SEU_TOKEN'
    },
    body: JSON.stringify({
      instanceId: 'sua-instancia',
      to: '5511999999999',
      type: 'text',
      text: 'Olá! Como posso ajudar?'
    })
  });
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.wapizap.com/api/v2/messages',
      headers={
          'Content-Type': 'application/json',
          'Authorization': 'Bearer SEU_TOKEN'
      },
      json={
          'instanceId': 'sua-instancia',
          'to': '5511999999999',
          'type': 'text',
          'text': 'Olá! Como posso ajudar?'
      }
  )
  ```
</CodeGroup>

***

## Mensagem com Imagem

Envie imagens com legenda opcional.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wapizap.com/api/v2/messages/media \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer SEU_TOKEN" \
    -d '{
      "instanceId": "sua-instancia",
      "to": "5511999999999",
      "type": "image",
      "mediaUrl": "https://exemplo.com/imagem.jpg",
      "caption": "Confira nossa promoção!"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.wapizap.com/api/v2/messages/media', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer SEU_TOKEN'
    },
    body: JSON.stringify({
      instanceId: 'sua-instancia',
      to: '5511999999999',
      type: 'image',
      mediaUrl: 'https://exemplo.com/imagem.jpg',
      caption: 'Confira nossa promoção!'
    })
  });
  ```
</CodeGroup>

<Info>
  Formatos suportados: JPG, PNG, GIF, WEBP. Tamanho máximo: 16MB.
</Info>

***

## Mensagem com Documento

Envie PDFs, planilhas e outros documentos.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wapizap.com/api/v2/messages/media \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer SEU_TOKEN" \
    -d '{
      "instanceId": "sua-instancia",
      "to": "5511999999999",
      "type": "document",
      "mediaUrl": "https://exemplo.com/contrato.pdf",
      "filename": "Contrato_2026.pdf"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.wapizap.com/api/v2/messages/media', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer SEU_TOKEN'
    },
    body: JSON.stringify({
      instanceId: 'sua-instancia',
      to: '5511999999999',
      type: 'document',
      mediaUrl: 'https://exemplo.com/contrato.pdf',
      filename: 'Contrato_2026.pdf'
    })
  });
  ```
</CodeGroup>

***

## Mensagem de Áudio

Envie arquivos de áudio ou grave mensagens de voz.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wapizap.com/api/v2/messages/audio \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer SEU_TOKEN" \
    -d '{
      "instanceId": "sua-instancia",
      "to": "5511999999999",
      "audioUrl": "https://exemplo.com/audio.mp3",
      "ptt": true
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.wapizap.com/api/v2/messages/audio', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer SEU_TOKEN'
    },
    body: JSON.stringify({
      instanceId: 'sua-instancia',
      to: '5511999999999',
      audioUrl: 'https://exemplo.com/audio.mp3',
      ptt: true // Push-to-talk (mensagem de voz)
    })
  });
  ```
</CodeGroup>

<Tip>
  Use `ptt: true` para enviar como mensagem de voz (bolinha verde). Use `ptt: false` para enviar como arquivo de áudio.
</Tip>

***

## Mensagem de Localização

Compartilhe coordenadas geográficas.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wapizap.com/api/v2/messages/location \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer SEU_TOKEN" \
    -d '{
      "instanceId": "sua-instancia",
      "to": "5511999999999",
      "latitude": -23.550520,
      "longitude": -46.633308,
      "name": "Escritório Wapizap",
      "address": "Av. Paulista, 1000 - São Paulo"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.wapizap.com/api/v2/messages/location', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer SEU_TOKEN'
    },
    body: JSON.stringify({
      instanceId: 'sua-instancia',
      to: '5511999999999',
      latitude: -23.550520,
      longitude: -46.633308,
      name: 'Escritório Wapizap',
      address: 'Av. Paulista, 1000 - São Paulo'
    })
  });
  ```
</CodeGroup>

***

## Mensagem de Contato

Compartilhe cartões de contato (vCard).

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wapizap.com/api/v2/messages/contact \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer SEU_TOKEN" \
    -d '{
      "instanceId": "sua-instancia",
      "to": "5511999999999",
      "contact": {
        "fullName": "João Silva",
        "phoneNumber": "5511988888888",
        "organization": "Empresa XYZ"
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.wapizap.com/api/v2/messages/contact', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer SEU_TOKEN'
    },
    body: JSON.stringify({
      instanceId: 'sua-instancia',
      to: '5511999999999',
      contact: {
        fullName: 'João Silva',
        phoneNumber: '5511988888888',
        organization: 'Empresa XYZ'
      }
    })
  });
  ```
</CodeGroup>

***

## Enquete (Poll)

Crie enquetes interativas.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wapizap.com/api/v2/messages/poll \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer SEU_TOKEN" \
    -d '{
      "instanceId": "sua-instancia",
      "to": "5511999999999",
      "name": "Qual o melhor horário para reunião?",
      "options": ["09:00", "14:00", "16:00"],
      "selectableCount": 1
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.wapizap.com/api/v2/messages/poll', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer SEU_TOKEN'
    },
    body: JSON.stringify({
      instanceId: 'sua-instancia',
      to: '5511999999999',
      name: 'Qual o melhor horário para reunião?',
      options: ['09:00', '14:00', '16:00'],
      selectableCount: 1
    })
  });
  ```
</CodeGroup>

***

## Reações

Adicione reações (emojis) a mensagens existentes.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.wapizap.com/api/v2/messages/reaction \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer SEU_TOKEN" \
    -d '{
      "instanceId": "sua-instancia",
      "messageId": "3EB0XXXXX",
      "remoteJid": "5511999999999@s.whatsapp.net",
      "reaction": "👍"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.wapizap.com/api/v2/messages/reaction', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer SEU_TOKEN'
    },
    body: JSON.stringify({
      instanceId: 'sua-instancia',
      messageId: '3EB0XXXXX',
      remoteJid: '5511999999999@s.whatsapp.net',
      reaction: '👍'
    })
  });
  ```
</CodeGroup>

<Tip>
  Para remover uma reação, envie `reaction: ""` (string vazia).
</Tip>

***

## Melhores Práticas

<CardGroup cols={2}>
  <Card title="Rate Limits" icon="gauge">
    Respeite o limite de 30 mensagens/minuto por instância para evitar bloqueios.
  </Card>

  <Card title="Formato do Número" icon="phone">
    Sempre use formato internacional sem símbolos (ex: 5511999999999).
  </Card>

  <Card title="Tamanho de Mídia" icon="image">
    Imagens até 16MB, vídeos até 64MB, documentos até 100MB.
  </Card>

  <Card title="Validação" icon="check">
    Use o endpoint `/contacts/check` para validar números antes de enviar.
  </Card>
</CardGroup>

***

## Próximos Passos

<CardGroup cols={2}>
  <Card title="Gerenciar Grupos" icon="users" href="/guides/managing-groups">
    Aprenda a criar e gerenciar grupos
  </Card>

  <Card title="Configurar Webhooks" icon="webhook" href="/guides/webhooks-setup">
    Receba notificações de mensagens
  </Card>
</CardGroup>
