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

# Conversas usuario

## Listar Conversas do Usuário

Este endpoint permite listar e filtrar conversas do usuário no sistema. Você pode usar vários parâmetros de consulta para filtrar os resultados conforme necessário.

### Casos de uso

* Obter histórico de conversas do usuário para análise
* Filtrar conversas por canal de comunicação
* Buscar conversas por período específico
* Exportar conversas para análise ou backup

### Parâmetros de consulta

| Parâmetro         | Tipo    | Descrição                                                                                                  |
| ----------------- | ------- | ---------------------------------------------------------------------------------------------------------- |
| agentId           | string  | Filtrar por ID do agente                                                                                   |
| channel           | string  | Filtrar por canal de conversação (whatsapp, dashboard, website, slack, crisp, mail, zapier, api, telegram) |
| channelExternalId | string  | Filtrar por ID externo do canal (ex: número de telefone para WhatsApp)                                     |
| search            | string  | Buscar em títulos de conversas, informações de contato e conteúdo das mensagens                            |
| startDate         | string  | Filtrar conversas a partir desta data (formato ISO 8601)                                                   |
| endDate           | string  | Filtrar conversas até esta data (formato ISO 8601)                                                         |
| fullConversation  | boolean | Incluir histórico completo da conversa (true) ou apenas resumo (false)                                     |
| simplified        | boolean | Retornar dados simplificados da conversa com apenas informações essenciais                                 |

<Card>
  <CardContent>
    Teste este endpoint diretamente do seu navegador.
  </CardContent>
</Card>

### Exemplos de código

<CodeGroup>
  ```javascript JavaScript theme={null}
  const fetchUserConversations = async () => {
    const response = await fetch('https://dash.superagentes.ai/api/user-conversations?channel=whatsapp&startDate=2024-01-01T00:00:00Z', {
      method: 'GET',
      headers: {
        'Authorization': `Bearer ${seu_token_jwt}`,
        'Content-Type': 'application/json'
      }
    });
    
    const data = await response.json();
    return data;
  };
  ```

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

  def fetch_user_conversations():
      headers = {
          'Authorization': f'Bearer {seu_token_jwt}',
          'Content-Type': 'application/json'
      }
      
      params = {
          'channel': 'whatsapp',
          'startDate': '2024-01-01T00:00:00Z'
      }
      
      response = requests.get('https://dash.superagentes.ai/api/user-conversations', headers=headers, params=params)
      
      return response.json()
  ```

  ```curl cURL theme={null}
  curl --request GET \
    --url 'https://dash.superagentes.ai/api/user-conversations?channel=whatsapp&startDate=2024-01-01T00:00:00Z' \
    --header 'Authorization: Bearer seu_token_jwt' \
    --header 'Content-Type: application/json'
  ```
</CodeGroup>

### Exemplo de resposta

<ResponseExample>
  ```json theme={null}
  [
    {
      "id": "conversation-id-1",
      "title": "Conversa com Cliente",
      "status": "UNRESOLVED",
      "channel": "whatsapp",
      "channelExternalId": "+5511999999999",
      "agent": {
        "id": "agent-id",
        "name": "Nome do Agente",
        "iconUrl": "https://exemplo.com/icon.png",
        "handle": "@agent_handle"
      },
      "contactInfo": {
        "phoneNumber": "+5511999999999",
        "name": "Nome do Cliente",
        "email": "cliente@exemplo.com"
      },
      "messages": [
        {
          "id": "message-id-1",
          "text": "Olá, como posso ajudar?",
          "from": "agent",
          "createdAt": "2024-01-01T00:00:00.000Z",
          "read": true,
          "attachments": []
        }
      ],
      "createdAt": "2024-01-01T00:00:00.000Z",
      "updatedAt": "2024-01-01T00:00:00.000Z"
    }
  ]
  ```
</ResponseExample>
