Update Conversation Property
Update Conversation Property
Update (upsert) the conversation-level property values using the conversation_id parameter. Only conversation properties defined on the Agent are saved (undefined property names are ignored), and values are normalized according to the conversation property's defined type. Only the properties passed in this request are updated; other properties are not affected.
Request Method
POST
Endpoint
https://api-${endpoint}.gptbots.ai/v1/conversation/property/update
Authentication
Refer to API Overview for authentication instructions.
Request
Example Request
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/conversation/property/update' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"conversation_id": "6a55ff78f847452309cae7d4",
"properties": [
{ "name": "vip_level", "value": "3" },
{ "name": "user_city", "value": "Bangkok" },
{ "name": "is_member", "value": "true" }
]
}'
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/conversation/property/update' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"conversation_id": "6a55ff78f847452309cae7d4",
"properties": [
{ "name": "vip_level", "value": "3" },
{ "name": "user_city", "value": "Bangkok" },
{ "name": "is_member", "value": "true" }
]
}'
This code block in the floating window
Request Headers
| Field | Type | Description |
|---|---|---|
| Authorization | Bearer ${API Key} | Use Authorization: Bearer ${API Key} for authentication. Obtain your API key from the API Key page. |
| Content-Type | application/json | Fixed value application/json. |
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| conversation_id | string | Yes | Conversation identifier. |
| properties | JSON Array | Yes | List of conversation properties to update. |
| name | string | Yes | Conversation property name. Must be a conversation property defined on the Agent; undefined names are ignored. |
| value | string | No | Conversation property value, always passed as a string: DATETIME as an epoch-millisecond string, BOOLEAN as "true"/"false", NUMBER/INTEGER as a numeric string, STRING as is. The backend automatically normalizes the value according to the conversation property's defined type. |
Response
Example Response
{
"code": 0,
"message": "OK"
}
{
"code": 0,
"message": "OK"
}
This code block in the floating window
Successful Response
| Field | Type | Description |
|---|---|---|
| code | int | Return code, 0 means success. |
| message | string | Description message. |
Error Response
| Field | Type | Description |
|---|---|---|
| code | int | Error code. |
| message | string | Error details. |
Error Codes
| Code | Message |
|---|---|
| 40000 | Invalid parameters |
| 40127 | Developer authentication failed |
| 40356 | Conversation does not exist |
| 20059 | Agent has been deleted |
