Update chat
curl --request PATCH \
--url https://api.upon-ai.com/api/chats/{chatId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspaceId": 42,
"metadata": {
"followUpOwner": "support"
},
"custom_attributes": {
"customerId": "cust_123"
},
"override_dynamic_variables": {
"discount_code": "SPRING15"
}
}
'import requests
url = "https://api.upon-ai.com/api/chats/{chatId}"
payload = {
"workspaceId": 42,
"metadata": { "followUpOwner": "support" },
"custom_attributes": { "customerId": "cust_123" },
"override_dynamic_variables": { "discount_code": "SPRING15" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspaceId: 42,
metadata: {followUpOwner: 'support'},
custom_attributes: {customerId: 'cust_123'},
override_dynamic_variables: {discount_code: 'SPRING15'}
})
};
fetch('https://api.upon-ai.com/api/chats/{chatId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.upon-ai.com/api/chats/{chatId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'workspaceId' => 42,
'metadata' => [
'followUpOwner' => 'support'
],
'custom_attributes' => [
'customerId' => 'cust_123'
],
'override_dynamic_variables' => [
'discount_code' => 'SPRING15'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.upon-ai.com/api/chats/{chatId}"
payload := strings.NewReader("{\n \"workspaceId\": 42,\n \"metadata\": {\n \"followUpOwner\": \"support\"\n },\n \"custom_attributes\": {\n \"customerId\": \"cust_123\"\n },\n \"override_dynamic_variables\": {\n \"discount_code\": \"SPRING15\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.upon-ai.com/api/chats/{chatId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspaceId\": 42,\n \"metadata\": {\n \"followUpOwner\": \"support\"\n },\n \"custom_attributes\": {\n \"customerId\": \"cust_123\"\n },\n \"override_dynamic_variables\": {\n \"discount_code\": \"SPRING15\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upon-ai.com/api/chats/{chatId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"workspaceId\": 42,\n \"metadata\": {\n \"followUpOwner\": \"support\"\n },\n \"custom_attributes\": {\n \"customerId\": \"cust_123\"\n },\n \"override_dynamic_variables\": {\n \"discount_code\": \"SPRING15\"\n }\n}"
response = http.request(request)
puts response.read_body{
"chatId": "<string>",
"agentId": "<string>",
"version": 123,
"status": "<string>",
"type": "web_chat",
"metadata": {},
"customAttributes": {},
"startedAt": "2023-11-07T05:31:56Z",
"endedAt": "2023-11-07T05:31:56Z",
"transcript": "<string>",
"messages": [
{
"content": "<string>",
"name": "<string>",
"tool_calls": [
{}
]
}
],
"chatCost": {},
"chatAnalysis": {},
"collectedDynamicVariables": {},
"uponai_dynamic_variables": {},
"overrideDynamicVariables": {}
}Chats
Update chat
Update metadata, custom attributes, or dynamic-variable overrides for an existing chat.
PATCH
/
api
/
chats
/
{chatId}
Update chat
curl --request PATCH \
--url https://api.upon-ai.com/api/chats/{chatId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workspaceId": 42,
"metadata": {
"followUpOwner": "support"
},
"custom_attributes": {
"customerId": "cust_123"
},
"override_dynamic_variables": {
"discount_code": "SPRING15"
}
}
'import requests
url = "https://api.upon-ai.com/api/chats/{chatId}"
payload = {
"workspaceId": 42,
"metadata": { "followUpOwner": "support" },
"custom_attributes": { "customerId": "cust_123" },
"override_dynamic_variables": { "discount_code": "SPRING15" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workspaceId: 42,
metadata: {followUpOwner: 'support'},
custom_attributes: {customerId: 'cust_123'},
override_dynamic_variables: {discount_code: 'SPRING15'}
})
};
fetch('https://api.upon-ai.com/api/chats/{chatId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.upon-ai.com/api/chats/{chatId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'workspaceId' => 42,
'metadata' => [
'followUpOwner' => 'support'
],
'custom_attributes' => [
'customerId' => 'cust_123'
],
'override_dynamic_variables' => [
'discount_code' => 'SPRING15'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.upon-ai.com/api/chats/{chatId}"
payload := strings.NewReader("{\n \"workspaceId\": 42,\n \"metadata\": {\n \"followUpOwner\": \"support\"\n },\n \"custom_attributes\": {\n \"customerId\": \"cust_123\"\n },\n \"override_dynamic_variables\": {\n \"discount_code\": \"SPRING15\"\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://api.upon-ai.com/api/chats/{chatId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workspaceId\": 42,\n \"metadata\": {\n \"followUpOwner\": \"support\"\n },\n \"custom_attributes\": {\n \"customerId\": \"cust_123\"\n },\n \"override_dynamic_variables\": {\n \"discount_code\": \"SPRING15\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.upon-ai.com/api/chats/{chatId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"workspaceId\": 42,\n \"metadata\": {\n \"followUpOwner\": \"support\"\n },\n \"custom_attributes\": {\n \"customerId\": \"cust_123\"\n },\n \"override_dynamic_variables\": {\n \"discount_code\": \"SPRING15\"\n }\n}"
response = http.request(request)
puts response.read_body{
"chatId": "<string>",
"agentId": "<string>",
"version": 123,
"status": "<string>",
"type": "web_chat",
"metadata": {},
"customAttributes": {},
"startedAt": "2023-11-07T05:31:56Z",
"endedAt": "2023-11-07T05:31:56Z",
"transcript": "<string>",
"messages": [
{
"content": "<string>",
"name": "<string>",
"tool_calls": [
{}
]
}
],
"chatCost": {},
"chatAnalysis": {},
"collectedDynamicVariables": {},
"uponai_dynamic_variables": {},
"overrideDynamicVariables": {}
}Authorizations
Generate tokens from your profile settings at app.uponai.com.
Path Parameters
Chat identifier.
Body
application/json
Response
200 - application/json
Updated chat session.
Example:
"web_chat"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I