Skip to main content
PATCH
/
v4
/
threads
/
{thread_id}
/
messages
/
{application_interaction_id}
JavaScript
import SGPClient from 'sgp';

const client = new SGPClient({
  apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});

const message = await client.chatThreads.messages.update('thread_id', 'application_interaction_id');

console.log(message.id);
{
  "id": "<string>",
  "input": {},
  "output": {},
  "aggregated": true,
  "application_spec_id": "<string>",
  "application_variant_id": "<string>",
  "start_timestamp": "2023-11-07T05:31:56Z",
  "duration_ms": 123,
  "operation_status": "SUCCESS",
  "created_at": "2023-11-07T05:31:56Z",
  "operation_metadata": {},
  "chat_thread_id": "<string>",
  "interaction_source": "EXTERNAL_AI"
}

Authorizations

x-api-key
string
header
required

Headers

x-selected-account-id
string

Path Parameters

thread_id
string
required
application_interaction_id
string
required

Query Parameters

fetch_by_account
boolean
default:false

Fetch the thread by account instead of user

Body

application/json
output_text
string

The output text generated by the application.

Response

Successful Response

id
string
required
input
Input · object
required
output
Output · object
required
aggregated
boolean
required

Boolean of whether this interaction has been uploaded to s3 bucket yet, default is false

application_spec_id
string
required
application_variant_id
string
required
start_timestamp
string<date-time>
required
duration_ms
integer
required

How much time the step took in milliseconds(ms)

operation_status
enum<string>
required

The outcome of the operation

Available options:
SUCCESS,
ERROR,
CANCELED
created_at
string<date-time>
required

The date and time when the entity was created in ISO format.

operation_metadata
Operation Metadata · object

The JSON representation of the metadata insights emitted through the execution. This can differ based on different types of operations

chat_thread_id
string
interaction_source
enum<string>
Available options:
EXTERNAL_AI,
EVALUATION,
SGP_CHAT,
AGENTS_SERVICE