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": {}
}Conversation
Close conversation
Close an active conversation with an end user
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": {}
}Description
Closes an active conversation in the external support panel. Allows specifying a closing message to send to the user and the reason for closing. Upon execution, Jelou emits theconversation.close event to the webhook configured in the integration.
Endpoint
POST https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/close
Path parameters
string
required
Unique identifier of the Jelou project from which the conversation is closed.
Body parameters
string
required
Identifier of the Jelou bot associated with the conversation.
string
required
Identifier of the end user whose conversation you want to close.
object
Message to be sent to the user at the time of closing the conversation.
type— Message type:textoredge.text— Text of the closing message (whentypeistext).
Authentication
All requests must include thex-api-key header with your Jelou project API key.
x-api-key: API_KEY
Request example
The following example closes the conversation for userUSER_ID and includes a closing message:
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": "Conversation closing message"
}
}'
Responses
| Code | Status | Description |
|---|---|---|
| 200 | OK | Conversation closed successfully. |
| 401 | Unauthorized | Invalid or missing authentication credentials. |
| 404 | Not Found | Bot or user not found. |
| 422 | Unprocessable Entity | Fields sent contain invalid values or fail validations. |
| 500 | Internal Server Error | Internal server error. |
Response example
{
"message": [
"Conversation closed successfully"
],
"statusMessage": "success",
"status": 1,
"data": {
"conversationId": "CONVERSATION_ID",
"status": "closed",
"endedReason": "closed_by_operator"
}
}
Webhook event conversation.close
When this resource is executed, Jelou will emit the conversation.close event to the webhook configured in the integration. The payload includes the close reason and the message sent to the user.
{
"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": "Conversation closing message"
}
}
}
Payload fields
| Field | Type | Description |
|---|---|---|
event | string | Event name: conversation.close |
timestamp | number | Unix timestamp in milliseconds at the time of the event. |
project_id | string | Jelou project identifier. |
room_id | string | Conversation room identifier. |
contact.id | string | End user identifier. |
contact.name | string | End user name. |
conversation.id | string | Unique identifier of the closed conversation. |
bot.id | string | Associated bot identifier. |
bot.name | string | Associated bot name. |
value.reason | string | Close reason: closed_by_operator. |
value.redirectPayload.type | string | Closing message type: text or edge. |
value.redirectPayload.text | string | Text of the message sent to the user upon closing (optional). |
Was this page helpful?
⌘I