Set session structured field values
curl --request PUT \
--url http://localhost:8080/chat/sessions/{session_id}/structured-field-values \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"values": [
{
"field_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": "<string>"
}
]
}
'import requests
url = "http://localhost:8080/chat/sessions/{session_id}/structured-field-values"
payload = { "values": [
{
"field_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
values: [{field_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', value: '<string>'}]
})
};
fetch('http://localhost:8080/chat/sessions/{session_id}/structured-field-values', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/chat/sessions/{session_id}/structured-field-values",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'values' => [
[
'field_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'value' => '<string>'
]
]
]),
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 := "http://localhost:8080/chat/sessions/{session_id}/structured-field-values"
payload := strings.NewReader("{\n \"values\": [\n {\n \"field_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("http://localhost:8080/chat/sessions/{session_id}/structured-field-values")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"values\": [\n {\n \"field_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/chat/sessions/{session_id}/structured-field-values")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"values\": [\n {\n \"field_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"org_id": "<string>",
"session_id": "<string>",
"field_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"applicable_field_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}Sessions
Set session structured field values
Set or clear Structured Field values on a session. Name each field by its ID or field key; Boolean and Number fields take JSON true/false and numbers.
PUT
/
chat
/
sessions
/
{session_id}
/
structured-field-values
Set session structured field values
curl --request PUT \
--url http://localhost:8080/chat/sessions/{session_id}/structured-field-values \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"values": [
{
"field_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": "<string>"
}
]
}
'import requests
url = "http://localhost:8080/chat/sessions/{session_id}/structured-field-values"
payload = { "values": [
{
"field_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": "<string>"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
values: [{field_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', value: '<string>'}]
})
};
fetch('http://localhost:8080/chat/sessions/{session_id}/structured-field-values', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8080",
CURLOPT_URL => "http://localhost:8080/chat/sessions/{session_id}/structured-field-values",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'values' => [
[
'field_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'value' => '<string>'
]
]
]),
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 := "http://localhost:8080/chat/sessions/{session_id}/structured-field-values"
payload := strings.NewReader("{\n \"values\": [\n {\n \"field_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("http://localhost:8080/chat/sessions/{session_id}/structured-field-values")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"values\": [\n {\n \"field_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8080/chat/sessions/{session_id}/structured-field-values")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"values\": [\n {\n \"field_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"value\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"org_id": "<string>",
"session_id": "<string>",
"field_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"value": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"applicable_field_ids": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
]
}{
"statusCode": 123,
"message": "<string>",
"error": "<string>"
}{
"values": [
{ "field_key": "escalated", "value": true },
{ "field_key": "seats", "value": 12 },
{ "field_id": "3f2b8c1e-5d4a-4e6b-9c7d-2a1b0e9f8d7c", "value": null }
]
}
null clears a field.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The unique identifier of the chat session
Body
application/json
Maximum array length:
50Show child attributes
Show child attributes
Was this page helpful?