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": {}
}Conversa
Encerrar conversa
Encerra uma conversa ativa com um usuário 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": {}
}Descrição
Encerra uma conversa ativa no painel de atendimento externo. Permite especificar uma mensagem de encerramento que será enviada ao usuário e o motivo do encerramento. Ao ser executado, o Jelou emite o eventoconversation.close para o webhook configurado na integração.
Endpoint
POST https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close
Parâmetros de rota
string
obrigatório
Identificador único do projeto Jelou a partir do qual a conversa é encerrada.
Parâmetros do corpo
string
obrigatório
Identificador do bot do Jelou associado à conversa.
string
obrigatório
Identificador do usuário final cuja conversa se deseja encerrar.
object
Mensagem que será enviada ao usuário no momento do encerramento da conversa.
type— Tipo de mensagem:textouedge.text— Texto da mensagem de encerramento (quandotypeétext).
Autenticação
Todas as requisições devem incluir o cabeçalhox-api-key com a API key do projeto Jelou.
x-api-key: API_KEY
Exemplo de requisição
O exemplo a seguir encerra a conversa do usuárioUSER_ID e inclui uma mensagem de encerramento:
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": "Mensagem de encerramento da conversa"
}
}'
Respostas
| Código | Status | Descrição |
|---|---|---|
| 200 | OK | Conversa encerrada com sucesso. |
| 401 | Unauthorized | Credenciais de autenticação inválidas ou ausentes. |
| 404 | Not Found | Bot ou usuário não encontrado. |
| 422 | Unprocessable Entity | Os campos enviados contêm valores inválidos ou não passam nas validações. |
| 500 | Internal Server Error | Erro interno do servidor. |
Exemplo de resposta
{
"message": [
"Conversation closed successfully"
],
"statusMessage": "success",
"status": 1,
"data": {
"conversationId": "CONVERSATION_ID",
"status": "closed",
"endedReason": "closed_by_operator"
}
}
Evento webhook conversation.close
Ao executar este recurso, o Jelou emitirá o evento conversation.close ao webhook configurado na integração. O payload inclui o motivo do encerramento e a mensagem enviada ao usuário.
{
"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": "Mensagem de encerramento da conversa"
}
}
}
Campos do payload
| Campo | Tipo | Descrição |
|---|---|---|
event | string | Nome do evento: conversation.close |
timestamp | number | Marca de tempo Unix em milissegundos do momento do evento. |
project_id | string | Identificador do projeto Jelou. |
room_id | string | Identificador da sala de conversa. |
contact.id | string | Identificador do usuário final. |
contact.name | string | Nome do usuário final. |
conversation.id | string | Identificador único da conversa encerrada. |
bot.id | string | Identificador do bot associado. |
bot.name | string | Nome do bot associado. |
value.reason | string | Motivo do encerramento: closed_by_operator. |
value.redirectPayload.type | string | Tipo da mensagem de encerramento: text ou edge. |
value.redirectPayload.text | string | Texto da mensagem enviada ao usuário ao encerrar (opcional). |
Autorizações
API key del proyecto de Jelou
Parâmetros de caminho
Unique identifier of the Jelou project
Corpo
application/json
Resposta
Conversation closed successfully
Esta página foi útil?
⌘I