API Reference
- Autenticação
- Agentes
- Conversas
- Conhecimentos
- Fontes de Conhecimentos
Conversas
Obter conversa usuario
{
"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?",
"html": "<p>Olá, como posso ajudar?</p>",
"from": "agent",
"conversationId": "conversation-id-1",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"read": true,
"attachments": [],
"user": {
"id": "user-id",
"name": "Nome do Usuário",
"picture": "https://exemplo.com/picture.jpg",
"customPicture": "https://exemplo.com/custom-picture.jpg"
},
"contact": {
"id": "contact-id",
"firstName": "Nome",
"lastName": "Sobrenome",
"phoneNumber": "+5511999999999",
"email": "cliente@exemplo.com"
},
"agent": {
"id": "agent-id",
"name": "Nome do Agente",
"iconUrl": "https://exemplo.com/icon.png"
}
}
],
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}
Obter Conversa do Usuário
Este endpoint permite obter os detalhes de uma conversa específica do usuário, incluindo seu histórico completo.
Casos de uso
- Visualizar detalhes completos de uma conversa específica
- Acessar histórico de mensagens de uma conversa
- Obter informações de contato e contexto da conversa
- Analisar interações entre usuário e agente
Parâmetros
Parâmetro | Tipo | Descrição |
---|---|---|
id | string | ID da conversa (obrigatório) |
simplified | boolean | Retornar dados simplificados da conversa com apenas informações essenciais |
Exemplos de código
const fetchUserConversation = async (conversationId) => {
const response = await fetch(`https://dash.superagentes.ai/api/user-conversations/${conversationId}`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${seu_token_jwt}`,
'Content-Type': 'application/json'
}
});
const data = await response.json();
return data;
};
Exemplo de resposta
{
"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?",
"html": "<p>Olá, como posso ajudar?</p>",
"from": "agent",
"conversationId": "conversation-id-1",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"read": true,
"attachments": [],
"user": {
"id": "user-id",
"name": "Nome do Usuário",
"picture": "https://exemplo.com/picture.jpg",
"customPicture": "https://exemplo.com/custom-picture.jpg"
},
"contact": {
"id": "contact-id",
"firstName": "Nome",
"lastName": "Sobrenome",
"phoneNumber": "+5511999999999",
"email": "cliente@exemplo.com"
},
"agent": {
"id": "agent-id",
"name": "Nome do Agente",
"iconUrl": "https://exemplo.com/icon.png"
}
}
],
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}
{
"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?",
"html": "<p>Olá, como posso ajudar?</p>",
"from": "agent",
"conversationId": "conversation-id-1",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z",
"read": true,
"attachments": [],
"user": {
"id": "user-id",
"name": "Nome do Usuário",
"picture": "https://exemplo.com/picture.jpg",
"customPicture": "https://exemplo.com/custom-picture.jpg"
},
"contact": {
"id": "contact-id",
"firstName": "Nome",
"lastName": "Sobrenome",
"phoneNumber": "+5511999999999",
"email": "cliente@exemplo.com"
},
"agent": {
"id": "agent-id",
"name": "Nome do Agente",
"iconUrl": "https://exemplo.com/icon.png"
}
}
],
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}