Recommander
Aperçu
Le message Recommander fournit des suggestions basées sur le contexte de conversation. Il aide les agents avec des recommandations pertinentes pour améliorer les interactions client.
Référence API
Point de Terminaison
- URL WebSocket :
wss://ws-{{tenant}}.oco.optave.{{tld}} - Point de Terminaison REST (POST) :
https://{{tenant}}.oco.optave.{{tld}}/message/recommend
Pour pouvoir envoyer des messages, il est nécessaire de s'authentifier d'abord.
Charge Utile de Requête
Le message recommend nécessite une charge utile contenant l'historique de conversation (conversations), connections.threadId, resources.offers, et context.organizationId (l'identifiant d'organisation spécifique à votre client). Les autres champs sont optionnels.
- REST
- WebSocket
{
session: {
sessionId: "a1b2c3d4-e5f6-7890-abcd-123456789012",
channel: { language: "en-US" },
interface: { type: "chat" }
},
request: {
requestId: "a1b2c3d4-e5f6-7890-1234-56789ab2345",
attributes: {
variant: "A"
},
connections: {
journeyId: "",
parentId: "",
threadId: "9e8d7c6b-5a49-3827-1605-948372615abc" // REQUIS
},
context: { // généré par optave
caseId: "",
departmentId: "",
operatorId: "",
organizationId: "f7e8d9c0-b1a2-3456-7890-123456789abc", // REQUIS
userId: ""
},
resources: {
offers: [ // REQUIS
{
// Please contact your optave representative to define the object you should send here
}
]
},
scope: {
conversations: [ // REQUIS
{
conversationId: "",
participants: [
{
participantId: "2c4f8a9b-1d3e-5f70-8293-456789012def",
displayName: "Alice Hawthorne",
role: "user"
},
{
participantId: "5b8c9d0e-2f4a-6b1c-9d8e-123456789abc",
displayName: "Tom Callahan",
role: "operator"
}
],
messages: [
{
content: "I am looking for holiday destinations in December",
participantId: "2c4f8a9b-1d3e-5f70-8293-456789012def",
timestamp: "2024-01-15T10:30:00.000Z"
},
{
content: "I would be happy to help you find the perfect holiday destination. Do you have any specific preferences?",
participantId: "5b8c9d0e-2f4a-6b1c-9d8e-123456789abc",
timestamp: "2024-01-15T10:30:30.000Z"
},
{
content: "I enjoy warm weather and beaches, but also interested in local culture",
participantId: "2c4f8a9b-1d3e-5f70-8293-456789012def",
timestamp: "2024-01-15T10:31:00.000Z"
}
],
metadata: {}
}
]
}
}
}
{
headers: {
correlationId: "20e35101-61e8-46e0-926d-6af84b378d95",
tenantId: "your-tenant-id-here",
traceId: "405101-61e8-46e0-926d-6af84b378d95",
idempotencyKey: "30e35101-61e8-46e0-926d-6af84b378d95",
identifier: "message",
action: "recommend",
schemaRef: "optave.message.v3",
sdkVersion: "3.2.1",
timestamp: "2025-09-05T16:30:00.000Z"
},
payload: {
session: {
sessionId: "a1b2c3d4-e5f6-7890-abcd-123456789012",
channel: { language: "en-US" },
interface: { type: "chat" }
},
request: {
requestId: "a1b2c3d4-e5f6-7890-1234-56789ab2345",
attributes: {
variant: "A"
},
connections: {
journeyId: "",
parentId: "",
threadId: "9e8d7c6b-5a49-3827-1605-948372615abc" // REQUIS
},
context: { // généré par optave
caseId: "",
departmentId: "",
operatorId: "",
organizationId: "f7e8d9c0-b1a2-3456-7890-123456789abc", // REQUIS
userId: ""
},
resources: {
offers: [ // REQUIS
{
// Please contact your optave representative to define the object you should send here
}
]
},
scope: {
conversations: [ // REQUIS
{
conversationId: "",
participants: [
{
participantId: "2c4f8a9b-1d3e-5f70-8293-456789012def",
displayName: "Alice Hawthorne",
role: "user"
},
{
participantId: "5b8c9d0e-2f4a-6b1c-9d8e-123456789abc",
displayName: "Tom Callahan",
role: "operator"
}
],
messages: [
{
content: "I am looking for holiday destinations in December",
participantId: "2c4f8a9b-1d3e-5f70-8293-456789012def",
timestamp: "2024-01-15T10:30:00.000Z"
},
{
content: "I would be happy to help you find the perfect holiday destination. Do you have any specific preferences?",
participantId: "5b8c9d0e-2f4a-6b1c-9d8e-123456789abc",
timestamp: "2024-01-15T10:30:30.000Z"
},
{
content: "I enjoy warm weather and beaches, but also interested in local culture",
participantId: "2c4f8a9b-1d3e-5f70-8293-456789012def",
timestamp: "2024-01-15T10:31:00.000Z"
}
],
metadata: {}
}
]
}
}
},
action: "message"
}
Réponses
🟢 Succès (200-201)
Lors de l'utilisation du WebSocket, vous recevrez des recommandations et des métriques d'évaluation supplémentaires :
{
action: "superpower",
actionType: "recommend",
state: "completed",
message: {
results: [
{
// ?
}
]
}
}
🔴 Erreur
Les messages d'erreur sont similaires en format aux messages de succès, mais contiennent un état d'erreur et un objet JSON "response" :
{
action: "superpower",
actionType: "<superpower-name>",
state: "error",
message: {
results: [
{
response: [
{
content: 'Erreur lors de la récupération des résultats'
}
]
}
]
}
}