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

# Status da Sessão

> Consulta o estado atual da conexão WhatsApp do canal

# Status da Sessão

O comando **Status** consulta o estado atual da conexão WhatsApp associada ao canal.
Ele retorna informações sobre se o usuário está logado, o estado da conexão e se a sessão está ativa.

## Requisição

```
POST /api/v1/message/SendCommand
```

```json theme={null}
{
  "channelId": "uuid-do-canal",
  "content": {
    "type": "STATUS",
    "commandType": "STATUS"
  }
}
```

<Note>
  Este comando não possui campos adicionais. Basta enviar `type` e `commandType` como `"STATUS"`.
</Note>

## Resposta da API

```json theme={null}
{
  "packageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
```

## Webhook de resposta

O resultado é entregue via webhook do tipo `STATUS_RESPONSE`:

```json theme={null}
{
  "packageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "channelId": "uuid-do-canal",
  "content": {
    "type": "STATUS_RESPONSE",
    "isUserLoggedIn": true,
    "connectionState": "CONNECTED",
    "isSessionConnected": true
  }
}
```

### Campos da resposta

| Campo                | Tipo      | Descrição                                                         |
| -------------------- | --------- | ----------------------------------------------------------------- |
| `isUserLoggedIn`     | `boolean` | Indica se o usuário está autenticado no WhatsApp                  |
| `connectionState`    | `string`  | Estado da conexão (ex: `CONNECTED`, `DISCONNECTED`, `CONNECTING`) |
| `isSessionConnected` | `boolean` | Indica se a sessão está ativa e conectada                         |

## Exemplo completo

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api-dev.messagefy.io/api/v1/message/SendCommand \
    -H "Content-Type: application/json" \
    -H "X-API-KEY: sua-api-key" \
    -d '{
      "channelId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "content": {
        "type": "STATUS",
        "commandType": "STATUS"
      }
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://api-dev.messagefy.io/api/v1/message/SendCommand",
      headers={
          "Content-Type": "application/json",
          "X-API-KEY": "sua-api-key"
      },
      json={
          "channelId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "content": {
              "type": "STATUS",
              "commandType": "STATUS"
          }
      }
  )

  print(response.json())
  # {"packageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6"}
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api-dev.messagefy.io/api/v1/message/SendCommand",
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "X-API-KEY": "sua-api-key",
      },
      body: JSON.stringify({
        channelId: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        content: {
          type: "STATUS",
          commandType: "STATUS",
        },
      }),
    }
  );

  const data = await response.json();
  console.log(data);
  // { packageId: "3fa85f64-5717-4562-b3fc-2c963f66afa6" }
  ```
</CodeGroup>

<Tip>
  Use o comando de status periodicamente para monitorar a saúde da conexão do seu canal.
  Combine com o webhook [Conexão](/comandos/iniciar-sessao) para ter visibilidade completa.
</Tip>
