Sessions
Upsert session meta
Writes or removes one key of the session’s custom data
(sessionMeta.custom), at any moment of the conversation. Accepts the
tenant’s plugin connection or a plugin installed on the tenant. Connected
operators are notified in real time. custom holds at most 50 keys.
The key shares the rule of a new contactMeta key, so the two kinds of
custom data read the same everywhere they are listed. The dot-free
charset also keeps a key from addressing a nested path.
PATCH
/
v1
/
tenants
/
{tenantID}
/
sessions
/
{sessionID}
/
meta
Upsert session meta
curl --request PATCH \
--url https://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"metaKey": "<string>",
"metaValue": "<string>"
}
'import requests
url = "https://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta"
payload = {
"metaKey": "<string>",
"metaValue": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({metaKey: '<string>', metaValue: '<string>'})
};
fetch('https://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta', 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://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta",
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([
'metaKey' => '<string>',
'metaValue' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta"
payload := strings.NewReader("{\n \"metaKey\": \"<string>\",\n \"metaValue\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"metaKey\": \"<string>\",\n \"metaValue\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metaKey\": \"<string>\",\n \"metaValue\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"session": {
"contactID": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"operatorID": "<string>",
"organizationID": "<string>",
"pluginConnectionID": "<string>",
"sessionActive": true,
"sessionChannel": "<string>",
"sessionCloseComments": "<string>",
"sessionID": "<string>",
"sessionInactivityAt": "2023-11-07T05:31:56Z",
"sessionInitiator": "contact",
"sessionKind": "transactional",
"sessionLastMessageID": "<string>",
"sessionLastSmartID": "<string>",
"sessionLastTag": "<string>",
"sessionMeta": {},
"sessionRating": {
"comment": "<string>",
"stars": 123,
"createdAt": "2023-11-07T05:31:56Z"
},
"sessionStatus": 123,
"sessionSubProcess": "<string>",
"sessionSummary": {},
"sessionTags": [
"<string>"
],
"sessionType": "auto",
"tenantID": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"closeMotive": "<string>",
"closedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"inboxID": "<string>",
"manualAt": "2023-11-07T05:31:56Z",
"queuedAt": "2023-11-07T05:31:56Z",
"sessionLastInboundAt": "2023-11-07T05:31:56Z",
"sessionListed": true,
"sessionManuallyClosedAt": "2023-11-07T05:31:56Z"
}
}{
"errors": [
{
"error": "MissingTenantIDError",
"error_code": 1001,
"message": "tenantID is required.",
"statusCode": 400
}
]
}{
"errors": [
{
"error": "UnauthorizedError",
"error_code": 1003,
"message": "You are not authorized to perform this request.",
"statusCode": 401
}
]
}{
"errors": [
{
"error": "ForbiddenError",
"error_code": 1004,
"message": "You do not have access to this resource.",
"statusCode": 403
}
]
}{
"errors": [
{
"error": "SessionNotFoundError",
"error_code": 1060,
"message": "Session not found.",
"statusCode": 404
}
]
}{
"errors": [
{
"error": "SessionMetaLimitReachedError",
"error_code": 1071,
"message": "The session custom data is full; remove a key before adding a new one.",
"statusCode": 422
}
]
}{
"errors": [
{
"error": "UnknownError",
"error_code": 5999,
"message": "For some unknown reason your request has not succeeded.",
"statusCode": 500
}
]
}Authorizations
pluginConnectionAuthpluginAuth
Path Parameters
Body
application/json
⌘I
Upsert session meta
curl --request PATCH \
--url https://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"metaKey": "<string>",
"metaValue": "<string>"
}
'import requests
url = "https://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta"
payload = {
"metaKey": "<string>",
"metaValue": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({metaKey: '<string>', metaValue: '<string>'})
};
fetch('https://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta', 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://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta",
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([
'metaKey' => '<string>',
'metaValue' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta"
payload := strings.NewReader("{\n \"metaKey\": \"<string>\",\n \"metaValue\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"metaKey\": \"<string>\",\n \"metaValue\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://services-api.talqui.chat/v1/tenants/{tenantID}/sessions/{sessionID}/meta")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metaKey\": \"<string>\",\n \"metaValue\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"session": {
"contactID": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"operatorID": "<string>",
"organizationID": "<string>",
"pluginConnectionID": "<string>",
"sessionActive": true,
"sessionChannel": "<string>",
"sessionCloseComments": "<string>",
"sessionID": "<string>",
"sessionInactivityAt": "2023-11-07T05:31:56Z",
"sessionInitiator": "contact",
"sessionKind": "transactional",
"sessionLastMessageID": "<string>",
"sessionLastSmartID": "<string>",
"sessionLastTag": "<string>",
"sessionMeta": {},
"sessionRating": {
"comment": "<string>",
"stars": 123,
"createdAt": "2023-11-07T05:31:56Z"
},
"sessionStatus": 123,
"sessionSubProcess": "<string>",
"sessionSummary": {},
"sessionTags": [
"<string>"
],
"sessionType": "auto",
"tenantID": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"closeMotive": "<string>",
"closedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z",
"inboxID": "<string>",
"manualAt": "2023-11-07T05:31:56Z",
"queuedAt": "2023-11-07T05:31:56Z",
"sessionLastInboundAt": "2023-11-07T05:31:56Z",
"sessionListed": true,
"sessionManuallyClosedAt": "2023-11-07T05:31:56Z"
}
}{
"errors": [
{
"error": "MissingTenantIDError",
"error_code": 1001,
"message": "tenantID is required.",
"statusCode": 400
}
]
}{
"errors": [
{
"error": "UnauthorizedError",
"error_code": 1003,
"message": "You are not authorized to perform this request.",
"statusCode": 401
}
]
}{
"errors": [
{
"error": "ForbiddenError",
"error_code": 1004,
"message": "You do not have access to this resource.",
"statusCode": 403
}
]
}{
"errors": [
{
"error": "SessionNotFoundError",
"error_code": 1060,
"message": "Session not found.",
"statusCode": 404
}
]
}{
"errors": [
{
"error": "SessionMetaLimitReachedError",
"error_code": 1071,
"message": "The session custom data is full; remove a key before adding a new one.",
"statusCode": 422
}
]
}{
"errors": [
{
"error": "UnknownError",
"error_code": 5999,
"message": "For some unknown reason your request has not succeeded.",
"statusCode": 500
}
]
}