curl -X POST "https://api.whaapy.com/conversations/v1/uuid/close" \
-H "Authorization: Bearer wha_xxxxx"
const conversationId = 'uuid';
await fetch(
`https://api.whaapy.com/conversations/v1/${conversationId}/close`,
{
method: 'POST',
headers: { 'Authorization': 'Bearer wha_xxxxx' }
}
);
import requests
conversation_id = 'uuid'
response = requests.post(
f'https://api.whaapy.com/conversations/v1/{conversation_id}/close',
headers={'Authorization': 'Bearer wha_xxxxx'}
)
data = response.json()
$conversationId = 'uuid';
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whaapy.com/conversations/v1/{$conversationId}/close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer wha_xxxxx"
],
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
{
"message": "Conversación cerrada exitosamente",
"advisorsToAnalyze": 1
}
Conversaciones
Cerrar Conversación
Cierra una conversación activa
POST
/
conversations
/
v1
/
{id}
/
close
curl -X POST "https://api.whaapy.com/conversations/v1/uuid/close" \
-H "Authorization: Bearer wha_xxxxx"
const conversationId = 'uuid';
await fetch(
`https://api.whaapy.com/conversations/v1/${conversationId}/close`,
{
method: 'POST',
headers: { 'Authorization': 'Bearer wha_xxxxx' }
}
);
import requests
conversation_id = 'uuid'
response = requests.post(
f'https://api.whaapy.com/conversations/v1/{conversation_id}/close',
headers={'Authorization': 'Bearer wha_xxxxx'}
)
data = response.json()
$conversationId = 'uuid';
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whaapy.com/conversations/v1/{$conversationId}/close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer wha_xxxxx"
],
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
{
"message": "Conversación cerrada exitosamente",
"advisorsToAnalyze": 1
}
Parámetros
string
required
UUID de la conversación
curl -X POST "https://api.whaapy.com/conversations/v1/uuid/close" \
-H "Authorization: Bearer wha_xxxxx"
const conversationId = 'uuid';
await fetch(
`https://api.whaapy.com/conversations/v1/${conversationId}/close`,
{
method: 'POST',
headers: { 'Authorization': 'Bearer wha_xxxxx' }
}
);
import requests
conversation_id = 'uuid'
response = requests.post(
f'https://api.whaapy.com/conversations/v1/{conversation_id}/close',
headers={'Authorization': 'Bearer wha_xxxxx'}
)
data = response.json()
$conversationId = 'uuid';
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.whaapy.com/conversations/v1/{$conversationId}/close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer wha_xxxxx"
],
]);
$response = curl_exec($curl);
$data = json_decode($response, true);
{
"message": "Conversación cerrada exitosamente",
"advisorsToAnalyze": 1
}
Efectos
Cerrar una conversación tiene los siguientes efectos:- Cambia el estado a
closed - Dispara webhook
conversation.closed(si tienes webhooks configurados) - Analiza performance de los agentes humanos que participaron
- La conversación puede reabrirse si el contacto envía un nuevo mensaje
El campo
advisorsToAnalyze indica cuántos agentes humanos participaron y serán analizados para métricas de performance.Errores
{
"error": "Not found",
"message": "Conversación no encontrada"
}
Casos de uso
Cerrar después de resolver ticket
Cerrar después de resolver ticket
Cuando un ticket se resuelve en tu sistema de soporte, cierra la conversación:
// Webhook de Zendesk/Freshdesk
async function onTicketResolved(ticketData) {
const phone = ticketData.customer.phone;
// Buscar conversación por teléfono
const conversation = await fetch(
`https://api.whaapy.com/conversations/v1/by-phone/${encodeURIComponent(phone)}`,
{ headers: { 'Authorization': 'Bearer wha_xxxxx' } }
).then(r => r.json());
if (conversation.data) {
// Cerrar conversación
await fetch(
`https://api.whaapy.com/conversations/v1/${conversation.data.id}/close`,
{
method: 'POST',
headers: { 'Authorization': 'Bearer wha_xxxxx' }
}
);
}
}
Cerrar conversaciones inactivas
Cerrar conversaciones inactivas
Cierra automáticamente conversaciones sin actividad:
// Cron job diario
async function closeInactiveConversations() {
// Obtener conversaciones inactivas por 7 días
const inactive = await fetch(
'https://api.whaapy.com/conversations/v1?filters=' +
encodeURIComponent(JSON.stringify({ inactiveDays: 7 })),
{ headers: { 'Authorization': 'Bearer wha_xxxxx' } }
).then(r => r.json());
for (const conv of inactive.data) {
await fetch(
`https://api.whaapy.com/conversations/v1/${conv.id}/close`,
{
method: 'POST',
headers: { 'Authorization': 'Bearer wha_xxxxx' }
}
);
}
}
Was this page helpful?