Sends a conversation message to an agent to start a new conversation or continue an existing one. This operation supports Server-Sent Events (SSE).
Operation description
Request
You can use this API to send a conversation message to an agent. The response can be streamed using Server-Sent Events (SSE).
If the
ConversationIdparameter is provided, the API continues the specified conversation. If this parameter is omitted, a new conversation is created.The
Configfield accepts additional input in JSON format.On success, the response includes information such as the message ID for the conversation turn and the reply content. On error, it includes the corresponding error code and error message.
Try it now
Test
RAM authorization
Request syntax
POST /api/v1/conversations/chat HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The request body. |
{} |
| InstanceId |
string |
Yes |
The instance ID. |
learn-pairec-xxx |
| ConversationId |
string |
No |
The conversation ID. Omit this parameter to start a new conversation, or provide it to continue an existing one. |
e47cfae9-c0cc-42e1-91e2-e67cdb0e7b96 |
| Content |
string |
Yes |
The content of the message. |
校验引擎配置 |
| Config |
string |
No |
Additional input for the request, in JSON format. |
{} |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response body. |
||
| RequestId |
string |
The request ID. |
728C5E01-ABF6-5AA8-B9FC-B3BA05DECC77 |
| ConversationId |
string |
The conversation ID. |
e47cfae9-c0cc-42e1-91e2-e67cdb0e7b96 |
| MessageId |
string |
The message ID. |
chat-abcdefg |
| Event |
string |
The event type. |
message |
| Answer |
string |
The content of the reply. |
FeatureDB近7天读写量为xxx |
| GmtCreateTime |
string |
The creation time. |
2021-12-15T23:24:33.132+08:00 |
| ErrorCode |
string |
The error code. |
SERVER_ERROR |
| ErrorMessage |
string |
The error message. |
connection failed |
| SkillName |
string |
"" |
|
| Func |
string |
"" |
|
| CallId |
string |
"" |
Examples
Success response
JSON format
{
"RequestId": "728C5E01-ABF6-5AA8-B9FC-B3BA05DECC77",
"ConversationId": "e47cfae9-c0cc-42e1-91e2-e67cdb0e7b96",
"MessageId": "chat-abcdefg",
"Event": "message",
"Answer": "FeatureDB近7天读写量为xxx",
"GmtCreateTime": "2021-12-15T23:24:33.132+08:00",
"ErrorCode": "SERVER_ERROR",
"ErrorMessage": "connection failed",
"SkillName": "\"\"",
"Func": "\"\"",
"CallId": "\"\""
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.