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

# Enviar Texto

> Envia uma mensagem de texto

Envia uma mensagem de texto simples para um contato ou grupo.

## Request Body

<ParamField body="sessionId" type="string" required>
  ID da sessão que enviará a mensagem.
</ParamField>

<ParamField body="to" type="string" required>
  Destinatário (número com DDI ou JID).

  **Exemplos:** `"5511999999999"` ou `"5511999999999@s.whatsapp.net"`
</ParamField>

<ParamField body="text" type="string" required>
  Conteúdo da mensagem.

  **Limite:** 65.536 caracteres
</ParamField>

<ParamField body="mentions" type="string[]">
  Array de JIDs para mencionar na mensagem.
</ParamField>

<ParamField body="quoted" type="object">
  Responder a uma mensagem específica.

  <Expandable title="Campos">
    <ParamField body="messageId" type="string" required>
      ID da mensagem a ser respondida.
    </ParamField>

    <ParamField body="participant" type="string">
      JID do participante (obrigatório em grupos).
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="viewOnce" default="false" type="boolean">
  Se a mensagem deve desaparecer após ser visualizada.
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl -X POST "https://api.oxenty.api.br/api/messages/text" \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "sessionId": "550e8400-e29b-41d4-a716-446655440000",
      "to": "5511999999999",
      "text": "Olá! Como posso ajudar?"
    }'
  ```

  ```typescript TypeScript theme={"system"}
  const message = await client.messages.sendText(sessionId, {
    to: '5511999999999',
    text: 'Olá! Como posso ajudar?',
  });
  ```

  ```python Python theme={"system"}
  message = client.messages.send_text(
      session_id,
      to='5511999999999',
      text='Olá! Como posso ajudar?'
  )
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={"system"}
  {
    "messageId": "3EB0ABC123DEF456789GHI",
    "status": "sent",
    "to": "5511999999999@s.whatsapp.net",
    "timestamp": "2024-01-15T10:30:00.000Z"
  }
  ```

  ```json 400 Bad Request theme={"system"}
  {
    "statusCode": 400,
    "error": "RECIPIENT_NOT_ON_WHATSAPP",
    "message": "O número informado não está no WhatsApp"
  }
  ```

  ```json 400 Bad Request theme={"system"}
  {
    "statusCode": 400,
    "error": "SESSION_NOT_CONNECTED",
    "message": "A sessão não está conectada"
  }
  ```
</ResponseExample>

## Formatação de Texto

O WhatsApp suporta formatação básica:

| Formato    | Sintaxe        | Resultado |
| ---------- | -------------- | --------- |
| Negrito    | `*texto*`      | **texto** |
| Itálico    | `_texto_`      | *texto*   |
| Riscado    | `~texto~`      | ~~texto~~ |
| Monoespaço | `` `código` `` | `código`  |

## Exemplo com Menções

Para mencionar alguém em grupos, inclua o JID no array `mentions` e use `@` no texto:

```json theme={"system"}
{
  "sessionId": "...",
  "to": "120363123456789012@g.us",
  "text": "Olá @João! Pode verificar isso?",
  "mentions": ["5511888888888@s.whatsapp.net"]
}
```
