Start Conversation
curl --request POST \
--url https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/start \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"botId": "<string>",
"userId": "<string>",
"initialMessage": "<string>",
"metadata": {},
"assignment": {
"type": "<string>",
"target": "<string>"
}
}
'import requests
url = "https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/start"
payload = {
"botId": "<string>",
"userId": "<string>",
"initialMessage": "<string>",
"metadata": {},
"assignment": {
"type": "<string>",
"target": "<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>',
initialMessage: '<string>',
metadata: {},
assignment: {type: '<string>', target: '<string>'}
})
};
fetch('https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/start', 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/start",
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>',
'initialMessage' => '<string>',
'metadata' => [
],
'assignment' => [
'type' => '<string>',
'target' => '<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/start"
payload := strings.NewReader("{\n \"botId\": \"<string>\",\n \"userId\": \"<string>\",\n \"initialMessage\": \"<string>\",\n \"metadata\": {},\n \"assignment\": {\n \"type\": \"<string>\",\n \"target\": \"<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/start")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"botId\": \"<string>\",\n \"userId\": \"<string>\",\n \"initialMessage\": \"<string>\",\n \"metadata\": {},\n \"assignment\": {\n \"type\": \"<string>\",\n \"target\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/start")
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 \"initialMessage\": \"<string>\",\n \"metadata\": {},\n \"assignment\": {\n \"type\": \"<string>\",\n \"target\": \"<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
Iniciar conversa
Inicia uma nova conversa com um usuário final
POST
/
v1
/
external-support
/
{projectId}
/
conversations
/
start
Start Conversation
curl --request POST \
--url https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/start \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"botId": "<string>",
"userId": "<string>",
"initialMessage": "<string>",
"metadata": {},
"assignment": {
"type": "<string>",
"target": "<string>"
}
}
'import requests
url = "https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/start"
payload = {
"botId": "<string>",
"userId": "<string>",
"initialMessage": "<string>",
"metadata": {},
"assignment": {
"type": "<string>",
"target": "<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>',
initialMessage: '<string>',
metadata: {},
assignment: {type: '<string>', target: '<string>'}
})
};
fetch('https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/start', 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/start",
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>',
'initialMessage' => '<string>',
'metadata' => [
],
'assignment' => [
'type' => '<string>',
'target' => '<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/start"
payload := strings.NewReader("{\n \"botId\": \"<string>\",\n \"userId\": \"<string>\",\n \"initialMessage\": \"<string>\",\n \"metadata\": {},\n \"assignment\": {\n \"type\": \"<string>\",\n \"target\": \"<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/start")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"botId\": \"<string>\",\n \"userId\": \"<string>\",\n \"initialMessage\": \"<string>\",\n \"metadata\": {},\n \"assignment\": {\n \"type\": \"<string>\",\n \"target\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/start")
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 \"initialMessage\": \"<string>\",\n \"metadata\": {},\n \"assignment\": {\n \"type\": \"<string>\",\n \"target\": \"<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
Inicia uma nova conversa com um usuário final no painel de atendimento externo. Permite especificar o canal que atenderá a conversa, o usuário destinatário, uma mensagem inicial e dados de atribuição a filas ou agentes. Ao ser executado, o Jelou emite o eventoconversation.start para o webhook configurado na integração.
Endpoint
POST https://gateway.jelou.ai/platform/v1/external-support/{projectId}/conversations/start
Parâmetros de rota
string
obrigatório
Identificador único do projeto Jelou a partir do qual a conversa é iniciada.
Parâmetros do corpo
string
obrigatório
Identificador do canal do Jelou que gerenciará a conversa.
string
obrigatório
Identificador do usuário final com quem a conversa será iniciada.
string
Mensagem inicial que será enviada ao iniciar a conversa. Se omitida, a conversa inicia sem mensagem prévia.
object
Dados adicionais associados à conversa. Podem incluir identificadores externos, números de ticket ou outro contexto relevante para o seu sistema.Exemplo:
{ "ticketId": "T-12345" }object
Configuração de atribuição da conversa a uma fila ou agente específico.
type— Tipo de atribuição:queue(fila),operator(operador) outeam(equipe).target— Nome da fila ou identificador do agente destino.
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 inicia uma conversa com atribuição à filaSUPORTE e inclui metadata de ticket:
cURL
curl --request POST \
--url https://gateway.jelou.ai/platform/v1/external-support/PROJECT_ID/conversations/start \
--header 'x-api-key: API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"botId": "BOT_ID",
"userId": "USER_ID",
"initialMessage": "Olá, preciso de ajuda",
"metadata": { "ticketId": "T-12345" },
"assignment": { "type": "queue", "target": "SUPORTE" }
}'
Respostas
| Código | Status | Descrição |
|---|---|---|
| 200 | OK | Conversa iniciada com sucesso. |
| 401 | Unauthorized | Credenciais de autenticação inválidas ou ausentes. |
| 404 | Not Found | Canal ou usuário não encontrado. |
| 422 | Bad Request | Campos obrigatórios ausentes ou formato inválido. |
| 500 | Internal Server Error | Erro interno do servidor. |
Exemplo de resposta
{
"message": [
"Conversation started successfully"
],
"statusMessage": "success",
"status": 1,
"data": {
"conversationId": "CONVERSATION_ID",
"botId": "BOT_ID",
"userId": "USER_ID",
"status": "active"
}
}
Evento webhook conversation.start
Ao executar este recurso, o Jelou emitirá o evento conversation.start ao webhook configurado na integração. O payload varia conforme os campos enviados na requisição.
- Payload básico
- Com atribuição e metadata
{
"event": "conversation.start",
"timestamp": 1776133797422,
"field": "conversation",
"object": "conversation_event",
"event_type": "start",
"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": {}
}
{
"event": "conversation.start",
"timestamp": 1776134145523,
"field": "conversation",
"object": "conversation_event",
"event_type": "start",
"project_id": "PROJECT_ID",
"room_id": "ROOM_ID",
"contact": {
"id": "USER_ID",
"name": "USER_NAME"
},
"conversation": {
"id": "CONVERSATION_ID",
"assignment": {
"type": "queue",
"target": "SUPORTE"
}
},
"bot": {
"id": "BOT_ID",
"name": "BOT_NAME"
},
"value": {
"initial_message": "Olá, bom dia",
"metadata": {
"ticketId": "T-12345"
}
}
}
Campos do payload
| Campo | Tipo | Descrição |
|---|---|---|
event | string | Nome do evento: conversation.start |
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 iniciada. |
conversation.assignment.type | string | Tipo de atribuição: queue ou direct. |
conversation.assignment.target | string | Nome da fila ou ID do agente destino. |
bot.id | string | Identificador do canal atribuído. |
bot.name | string | Nome do canal atribuído. |
value.initial_message | string | Mensagem inicial enviada ao iniciar a conversa (opcional). |
value.metadata | object | Metadata adicional da conversa (opcional). |
Autorizações
API key del proyecto de Jelou
Parâmetros de caminho
Unique identifier of the Jelou project
Corpo
application/json
Resposta
Conversation started successfully
Esta página foi útil?
⌘I