Close Conversation
curl --request POST \
--url https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"botId": "<string>",
"userId": "<string>",
"redirectPayload": {
"type": "<string>",
"text": "<string>"
}
}
'import requests
url = "https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close"
payload = {
"botId": "<string>",
"userId": "<string>",
"redirectPayload": {
"type": "<string>",
"text": "<string>"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
botId: '<string>',
userId: '<string>',
redirectPayload: {type: '<string>', text: '<string>'}
})
};
fetch('https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'botId' => '<string>',
'userId' => '<string>',
'redirectPayload' => [
'type' => '<string>',
'text' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close"
payload := strings.NewReader("{\n \"botId\": \"<string>\",\n \"userId\": \"<string>\",\n \"redirectPayload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"botId\": \"<string>\",\n \"userId\": \"<string>\",\n \"redirectPayload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"botId\": \"<string>\",\n \"userId\": \"<string>\",\n \"redirectPayload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}Conversación
Cerrar conversación
Cierra una conversación activa con un usuario final
POST
/
v1
/
external-support
/
{projectId}
/
conversations
/
close
Close Conversation
curl --request POST \
--url https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"botId": "<string>",
"userId": "<string>",
"redirectPayload": {
"type": "<string>",
"text": "<string>"
}
}
'import requests
url = "https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close"
payload = {
"botId": "<string>",
"userId": "<string>",
"redirectPayload": {
"type": "<string>",
"text": "<string>"
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
botId: '<string>',
userId: '<string>',
redirectPayload: {type: '<string>', text: '<string>'}
})
};
fetch('https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'botId' => '<string>',
'userId' => '<string>',
'redirectPayload' => [
'type' => '<string>',
'text' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close"
payload := strings.NewReader("{\n \"botId\": \"<string>\",\n \"userId\": \"<string>\",\n \"redirectPayload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"botId\": \"<string>\",\n \"userId\": \"<string>\",\n \"redirectPayload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"botId\": \"<string>\",\n \"userId\": \"<string>\",\n \"redirectPayload\": {\n \"type\": \"<string>\",\n \"text\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}{
"message": "<string>",
"statusMessage": "<string>",
"status": 123,
"error": {
"code": "<string>",
"key": "<string>",
"description": "<string>",
"developerMessages": {},
"clientMessages": {}
},
"validationError": {}
}Descripción
Cierra una conversación activa en el panel de atención externo. Permite especificar un mensaje de cierre que se enviará al usuario y la razón del cierre. Al ejecutarse, Jelou emite el eventoconversation.close hacia el webhook configurado en la integración.
Endpoint
POST https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close
Parámetros de ruta
string
requerido
Identificador único del proyecto de Jelou desde el que se cierra la conversación.
Parámetros del cuerpo
string
requerido
Identificador del bot de Jelou asociado a la conversación.
string
requerido
Identificador del usuario final cuya conversación se desea cerrar.
object
Mensaje que se enviará al usuario al momento del cierre de la conversación.
type— Tipo de mensaje:textoedge.text— Texto del mensaje de cierre (cuandotypeestext).
Autenticación
Todas las peticiones deben incluir el encabezadox-api-key con la API key del proyecto de Jelou.
x-api-key: API_KEY
Ejemplo de solicitud
El siguiente ejemplo cierra la conversación del usuarioUSER_ID e incluye un mensaje de cierre:
cURL
curl --request POST \
--url https://gateway.jelou.ai/platform/v1/external-support/PROJECT_ID/conversations/close \
--header 'x-api-key: API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"botId": "BOT_ID",
"userId": "USER_ID",
"redirectPayload": {
"type": "text",
"text": "Mensaje de cierre de conversación"
}
}'
Respuestas
| Código | Estado | Descripción |
|---|---|---|
| 200 | OK | Conversación cerrada exitosamente. |
| 401 | Unauthorized | Credenciales de autenticación inválidas o faltantes. |
| 404 | Not Found | Bot o usuario no encontrado. |
| 422 | Unprocessable Entity | Los campos enviados contienen valores inválidos o no cumplen las validaciones esperadas. |
| 500 | Internal Server Error | Error interno del servidor. |
Ejemplo de respuesta
{
"message": [
"Conversation closed successfully"
],
"statusMessage": "success",
"status": 1,
"data": {
"conversationId": "CONVERSATION_ID",
"status": "closed",
"endedReason": "closed_by_operator"
}
}
Evento webhook conversation.close
Al ejecutar este recurso, Jelou emitirá el evento conversation.close al webhook configurado en la integración. El payload incluye la razón del cierre y el mensaje enviado al usuario.
{
"event": "conversation.close",
"timestamp": 1777992928697,
"field": "conversation",
"object": "conversation_event",
"event_type": "close",
"project_id": "PROJECT_ID",
"room_id": "ROOM_ID",
"contact": {
"id": "USER_ID",
"name": "USER_NAME"
},
"conversation": {
"id": "CONVERSATION_ID"
},
"bot": {
"id": "BOT_ID",
"name": "BOT_NAME"
},
"value": {
"reason": "closed_by_operator",
"redirectPayload": {
"type": "text",
"text": "Mensaje de cierre de conversación"
}
}
}
Campos del payload
| Campo | Tipo | Descripción |
|---|---|---|
event | string | Nombre del evento: conversation.close |
timestamp | number | Marca de tiempo Unix en milisegundos del momento del evento. |
project_id | string | Identificador del proyecto de Jelou. |
room_id | string | Identificador de la sala de conversación. |
contact.id | string | Identificador del usuario final. |
contact.name | string | Nombre del usuario final. |
conversation.id | string | Identificador único de la conversación cerrada. |
bot.id | string | Identificador del bot asociado. |
bot.name | string | Nombre del bot asociado. |
value.reason | string | Razón del cierre: closed_by_operator. |
value.redirectPayload.type | string | Tipo del mensaje de cierre: text o edge. |
value.redirectPayload.text | string | Texto del mensaje enviado al usuario al cerrar (opcional). |
Autorizaciones
API key del proyecto de Jelou
Parámetros de ruta
Unique identifier of the Jelou project
Cuerpo
application/json
Respuesta
Conversation closed successfully
¿Esta página le ayudó?
⌘I