Get client info by session ID
Returns client information by session ID with LEFT JOIN to Person and Sell tables. Includes phone extraction, status calculation, and sales aggregation. Returns fallback values when person not found.
Returns client information by session ID with LEFT JOIN to Person and Sell tables. Includes phone extraction, status calculation, and sales aggregation. Returns fallback values when person not found.
In: header
Path Parameters
Response Body
application/json
curl -X GET "https://example.com/sdr/sessions/string/client"{
"clientName": "João da Silva",
"phone": "5511999999999",
"phoneFormatted": "+55 11 99999-9999",
"isRegistered": true,
"salesCount": 3,
"lastSaleDate": "2025-11-01T12:00:00Z",
"status": "active",
"personId": "550e8400-e29b-41d4-a716-446655440000"
}List SDR contacts with data cross-referencing
Returns paginated list of unique contacts (grouped by session_id) with LEFT JOIN to Person and Sell tables for data enrichment. Includes aggregated metrics: totalContacts, activeContacts, conversionRate, totalMessages.
Create SDR interaction
Cria uma nova interação SDR e atualiza a tabela sell com informações de contato e qualificação. **Identificação do Contato:** O agente SDR deve fornecer **UM** dos seguintes campos para identificar o lead: - `phone`: Número de telefone do lead (formato brasileiro, com ou sem código 55) - Exemplo: `"5511999999999"` ou `"11999999999"` - `session_id`: UUID da sessão web (formato: Lia-{uuid}) - Exemplo: `"Lia-2a08196b-ac9a-4984-9f78-a681cf3653c3"` - Use quando o contato veio do chat web (sem telefone disponível) **Campos Obrigatórios:** - `phone` OU `session_id` (um dos dois) - `channel`: Canal usado ('whatsapp', 'sms', 'email') - `result`: Resultado da interação ('interested', 'not_interested', 'no_response', 'callback_requested', 'converted') **Comportamento:** - Busca pessoa existente pelo telefone (com matching flexível) ou cria pessoa mínima se não existir - Para UUIDs web, cria pessoa mínima automaticamente - Cria/atualiza registro em `sdr_interactions` - Atualiza tabela `sell` com informações de contato e qualificação - Sincroniza dados entre ambas as tabelas automaticamente - Evita duplicatas (atualiza se houver interação recente para o mesmo telefone/pessoa) **Exemplos de Uso:** 1. **Contato por telefone - Lead interessado:** - Fornece `phone` - Define `contact: true` e `result: "interested"` 2. **Contato por telefone - Lead qualificado:** - Fornece `phone` - Define `contact: true`, `sent: true`, `sent_to`, `converted_to_lead: true` 3. **Contato web (UUID) - Lead interessado:** - Fornece `session_id` (formato: Lia-{uuid}) - Define `contact: true` e `result: "interested"` 4. **Contato web (UUID) - Lead qualificado:** - Fornece `session_id` - Define `contact: true`, `sent: true`, `sent_to`, `converted_to_lead: true`