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

# Enviar Mensagem

> Envie uma mensagem para uma sessão ativa.

Envie uma mensagem para uma sessão ativa. O motor de fluxos processa a mensagem, avança para o próximo nó e entrega a resposta para a URL de callback.

<ParamField header="X-Api-Key" type="string" required>
  Sua chave de API (prefixada com `wh_`).
</ParamField>

<ParamField path="sessionId" type="string" required>
  O UUID da sessão ativa.
</ParamField>

### Body

<ParamField body="type" type="string" required>
  Tipo da mensagem: `text`, `interactive`, `image`, `video`, `audio`, `document` ou `sticker`.
</ParamField>

<ParamField body="text" type="object">
  Payload de texto. Envie quando `type` for `text`.

  <Expandable title="Campos">
    <ParamField body="text.body" type="string" required>
      O conteúdo de texto da mensagem.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="media" type="object">
  Payload de mídia. Envie quando `type` for `image`, `video`, `audio`, `document` ou `sticker`.

  <Expandable title="Campos">
    <ParamField body="media.mimeType" type="string" required>
      Tipo MIME do arquivo (ex: `image/png`, `video/mp4`).
    </ParamField>

    <ParamField body="media.url" type="string" required>
      URL pública do arquivo.
    </ParamField>

    <ParamField body="media.caption" type="string">
      Legenda da mídia.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="interactive" type="object">
  Payload interativo. Envie quando `type` for `interactive`.

  <Expandable title="Campos">
    <ParamField body="interactive.type" type="string" required>
      Tipo de interação: `button_reply` ou `list_reply`.
    </ParamField>

    <ParamField body="interactive.button_reply" type="object">
      Resposta de botão.

      <Expandable title="Campos">
        <ParamField body="interactive.button_reply.id" type="string" required>
          O ID do botão.
        </ParamField>

        <ParamField body="interactive.button_reply.title" type="string" required>
          O rótulo do botão.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="interactive.list_reply" type="object">
      Resposta de lista.

      <Expandable title="Campos">
        <ParamField body="interactive.list_reply.id" type="string" required>
          O ID da linha selecionada.
        </ParamField>

        <ParamField body="interactive.list_reply.title" type="string" required>
          O título da linha selecionada.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

### Exemplos de payload

<Tabs>
  <Tab title="Texto">
    ```json theme={null}
    {
      "type": "text",
      "text": {
        "body": "Olá, como posso ajudar?"
      }
    }
    ```
  </Tab>

  <Tab title="Imagem">
    ```json theme={null}
    {
      "type": "image",
      "media": {
        "mimeType": "image/png",
        "url": "https://exemplo.com/foto.png",
        "caption": "Foto do produto"
      }
    }
    ```
  </Tab>

  <Tab title="Vídeo">
    ```json theme={null}
    {
      "type": "video",
      "media": {
        "mimeType": "video/mp4",
        "url": "https://exemplo.com/video.mp4",
        "caption": "Vídeo tutorial"
      }
    }
    ```
  </Tab>

  <Tab title="Áudio">
    ```json theme={null}
    {
      "type": "audio",
      "media": {
        "mimeType": "audio/ogg",
        "url": "https://exemplo.com/audio.ogg",
        "caption": "Mensagem de voz"
      }
    }
    ```
  </Tab>

  <Tab title="Documento">
    ```json theme={null}
    {
      "type": "document",
      "media": {
        "mimeType": "application/pdf",
        "url": "https://exemplo.com/contrato.pdf",
        "caption": "Contrato"
      }
    }
    ```
  </Tab>

  <Tab title="Sticker">
    ```json theme={null}
    {
      "type": "sticker",
      "media": {
        "mimeType": "image/webp",
        "url": "https://exemplo.com/sticker.webp"
      }
    }
    ```
  </Tab>

  <Tab title="Botão">
    ```json theme={null}
    {
      "type": "interactive",
      "interactive": {
        "type": "button_reply",
        "button_reply": {
          "id": "btn_support",
          "title": "Suporte"
        }
      }
    }
    ```
  </Tab>

  <Tab title="Lista">
    ```json theme={null}
    {
      "type": "interactive",
      "interactive": {
        "type": "list_reply",
        "list_reply": {
          "id": "row_pricing",
          "title": "Planos e Preços"
        }
      }
    }
    ```
  </Tab>
</Tabs>

<RequestExample>
  ```bash Texto theme={null}
  curl -X POST https://api.whatabot.app/api/v1/sessions/{sessionId}/message \
    -H "X-Api-Key: wh_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{"type": "text", "text": {"body": "Olá, como posso ajudar?"}}'
  ```

  ```bash Imagem theme={null}
  curl -X POST https://api.whatabot.app/api/v1/sessions/{sessionId}/message \
    -H "X-Api-Key: wh_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{"type": "image", "media": {"mimeType": "image/png", "url": "https://exemplo.com/foto.png", "caption": "Foto do produto"}}'
  ```

  ```bash Vídeo theme={null}
  curl -X POST https://api.whatabot.app/api/v1/sessions/{sessionId}/message \
    -H "X-Api-Key: wh_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{"type": "video", "media": {"mimeType": "video/mp4", "url": "https://exemplo.com/video.mp4", "caption": "Vídeo tutorial"}}'
  ```

  ```bash Áudio theme={null}
  curl -X POST https://api.whatabot.app/api/v1/sessions/{sessionId}/message \
    -H "X-Api-Key: wh_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{"type": "audio", "media": {"mimeType": "audio/ogg", "url": "https://exemplo.com/audio.ogg", "caption": "Mensagem de voz"}}'
  ```

  ```bash Documento theme={null}
  curl -X POST https://api.whatabot.app/api/v1/sessions/{sessionId}/message \
    -H "X-Api-Key: wh_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{"type": "document", "media": {"mimeType": "application/pdf", "url": "https://exemplo.com/contrato.pdf", "caption": "Contrato"}}'
  ```

  ```bash Sticker theme={null}
  curl -X POST https://api.whatabot.app/api/v1/sessions/{sessionId}/message \
    -H "X-Api-Key: wh_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{"type": "sticker", "media": {"mimeType": "image/webp", "url": "https://exemplo.com/sticker.webp"}}'
  ```

  ```bash Resposta de Botão theme={null}
  curl -X POST https://api.whatabot.app/api/v1/sessions/{sessionId}/message \
    -H "X-Api-Key: wh_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{"type": "interactive", "interactive": {"type": "button_reply", "button_reply": {"id": "btn_support", "title": "Suporte"}}}'
  ```

  ```bash Resposta de Lista theme={null}
  curl -X POST https://api.whatabot.app/api/v1/sessions/{sessionId}/message \
    -H "X-Api-Key: wh_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{"type": "interactive", "interactive": {"type": "list_reply", "list_reply": {"id": "row_pricing", "title": "Planos e Preços"}}}'
  ```
</RequestExample>

<ResponseExample>
  ```json 202 theme={null}
  {
    "messageId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "status": "queued"
  }
  ```
</ResponseExample>
