Skip to main content
Version: 3.2.x

Adjust

Overview

The Adjust message allows an agent to request modifications to previously returned replies. It provides the ability to refine and improve content based on specific instructions given in plain English.

API Reference

Endpoint

  • WebSocket URL: wss://ws-{{tenant}}.oco.optave.{{tld}}
  • REST Endpoint (POST): https://{{tenant}}.oco.optave.{{tld}}/message/adjust

To be able to send messages, it is necessary to authenticate first.

Request Payload

The adjust message requires a payload containing the conversation history (conversations), connections.threadId, connections.parentId (ID of the message to adjust), the adjustment instructions in attributes (instruction and content), and context.organizationId (your client-specific organization ID). The other fields are optional.

{
session: {
sessionId: "a1b2c3d4-e5f6-7890-abcd-123456789012",
channel: { language: "en-US" },
interface: { type: "chat" }
},
request: {
requestId: "a1b2c3d4-e5f6-7890-1234-56789ab2345",
attributes: {
content: "Sure, Lucy! What would you like to know about the helicopter trip?", // REQUIRED - content to adjust
instruction: "Make it very friendly and funny", // REQUIRED - adjustment instruction
variant: "A"
},
connections: {
journeyId: "",
parentId: "9e8d7c6b-5a4f-3e2d-1c0b-0987654321ab", // REQUIRED - ID of the message to edit
threadId: "9e8d7c6b-5a49-3827-1605-948372615abc" // REQUIRED
},
context: { // generated by optave
organizationId: "f7e8d9c0-b1a2-3456-7890-123456789abc", // REQUIRED
},
reference: {
ids: [
{ name: "", value: "" }
],
labels: [],
tags: []
},
resources: {
codes: [],
links: [],
offers: []
},
scope: {
conversations: [ // REQUIRED
{
conversationId: "",
participants: [
{
participantId: "2c4f8a9b-1d3e-5f70-8293-456789012def",
displayName: "Lucy Carmichael",
role: "user"
}
],
messages: [
{
content: "Hi, I have a question about the helicopter trip",
participantId: "2c4f8a9b-1d3e-5f70-8293-456789012def",
timestamp: "2024-01-15T10:30:00.000Z"
}
],
metadata: {}
}
]
}
}
}

Responses

🟢 Success (200-201)

The response consists of an adjust_suggestion superpower.

When using the Websocket, multiple other superpowers and different state updates will also be received.

{
action: "superpower",
actionType: "adjust_suggestion",
state: "completed",
message: {
results: [
{
response: [
{
content: 'Friendlier response'
}
]
}
]
}
}

🔴 Error

Error messages are similar in format to success messages, but contain an error state and a "response" JSON object:

{
action: "superpower",
actionType: "<superpower-name>",
state: "error",
message: {
results: [
{
response: [
{
content: 'Error while fetching results'
}
]
}
]
}
}

curl
--request POST
--url https://{{tenant}}.oco.optave.{{tld}}/message/adjust
--header "Authorization: Bearer your-access-token-here"
--header "Content-Type: application/json"
-d '{
"session": {
"sessionId": "a1b2c3d4-e5f6-7890-abcd-123456789012",
"channel": { "language": "en-US" },
"interface": { "type": "chat" }
},
"request": {
"requestId": "a1b2c3d4-e5f6-7890-1234-56789ab2345",
"attributes": {
"content": "Sure, Lucy! What would you like to know about the helicopter trip?",
"instruction": "Make it very friendly and funny",
"variant": "A"
},
"connections": {
"parentId": "9e8d7c6b-5a4f-3e2d-1c0b-0987654321ab",
"threadId": "9e8d7c6b-5a49-3827-1605-948372615abc"
},
"context": {
"organizationId": "f7e8d9c0-b1a2-3456-7890-123456789abc"
},
"scope": {
"conversations": [
{
"conversationId": "7f6e5d4c-3b2a-1098-fedc-ba9876543210",
"participants": [
{
"participantId": "2c4f8a9b-1d3e-5f70-8293-456789012def",
"displayName": "Lucy Carmichael",
"role": "user"
}
],
"messages": [
{
"content": "Hi, I have a question about the helicopter trip",
"participantId": "2c4f8a9b-1d3e-5f70-8293-456789012def",
"timestamp": "2024-01-15T10:30:00.000Z"
}
],
"metadata": {}
}
]
}
}
}'
{
action: "superpower",
actionType: "adjust_suggestion",
state: "completed",
message: {
results: [
{
response: [
{
content: "Hey Lucy! I'd love to help you with the helicopter trip! What would you like to know? I'm here to make sure you have an amazing experience!"
}
]
}
]
}
}