curl --request POST \
--url https://api.osvi.ai/v1/chat/inbound \
--header 'API-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"customer_id": "+15551112222",
"content": "Hi, I need help.",
"session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8"
}
'import requests
url = "https://api.osvi.ai/v1/chat/inbound"
payload = {
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"customer_id": "+15551112222",
"content": "Hi, I need help.",
"session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8"
}
headers = {
"API-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_uuid: 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
customer_id: '+15551112222',
content: 'Hi, I need help.',
session_id: '4718a326-417b-4dda-90d0-21fd65a11cb8'
})
};
fetch('https://api.osvi.ai/v1/chat/inbound', 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.osvi.ai/v1/chat/inbound",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_uuid' => 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
'customer_id' => '+15551112222',
'content' => 'Hi, I need help.',
'session_id' => '4718a326-417b-4dda-90d0-21fd65a11cb8'
]),
CURLOPT_HTTPHEADER => [
"API-Token: <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://api.osvi.ai/v1/chat/inbound"
payload := strings.NewReader("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"customer_id\": \"+15551112222\",\n \"content\": \"Hi, I need help.\",\n \"session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Token", "<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.post("https://api.osvi.ai/v1/chat/inbound")
.header("API-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"customer_id\": \"+15551112222\",\n \"content\": \"Hi, I need help.\",\n \"session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.osvi.ai/v1/chat/inbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"customer_id\": \"+15551112222\",\n \"content\": \"Hi, I need help.\",\n \"session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8",
"reply": "Sure — I can help with that. What's your order number?",
"state": "default",
"mode": "ai",
"help_requested": false
}
}{
"success": false,
"error": "agent_not_found"
}{
"success": false,
"error": "agent_not_found"
}{
"success": false,
"error": "agent_not_found"
}{
"success": false,
"error": "agent_not_found"
}{
"success": false,
"error": "Python engine returned 422 for POST /v1/chat/session/{id}/support",
"upstream_body": {
"state": "rejected",
"reason": "tell_not_allowed_during_takeover"
}
}Send Message
Sends an inbound customer message into the chat engine and returns the agent’s reply synchronously.
session_id is optional. If omitted, the engine resolves the customer’s active session for this agent (creating or resuming as needed), so a typical integration only needs agent_uuid, customer_id, and content.
curl --request POST \
--url https://api.osvi.ai/v1/chat/inbound \
--header 'API-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"customer_id": "+15551112222",
"content": "Hi, I need help.",
"session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8"
}
'import requests
url = "https://api.osvi.ai/v1/chat/inbound"
payload = {
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"customer_id": "+15551112222",
"content": "Hi, I need help.",
"session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8"
}
headers = {
"API-Token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'API-Token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
agent_uuid: 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
customer_id: '+15551112222',
content: 'Hi, I need help.',
session_id: '4718a326-417b-4dda-90d0-21fd65a11cb8'
})
};
fetch('https://api.osvi.ai/v1/chat/inbound', 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.osvi.ai/v1/chat/inbound",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'agent_uuid' => 'agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og',
'customer_id' => '+15551112222',
'content' => 'Hi, I need help.',
'session_id' => '4718a326-417b-4dda-90d0-21fd65a11cb8'
]),
CURLOPT_HTTPHEADER => [
"API-Token: <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://api.osvi.ai/v1/chat/inbound"
payload := strings.NewReader("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"customer_id\": \"+15551112222\",\n \"content\": \"Hi, I need help.\",\n \"session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("API-Token", "<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.post("https://api.osvi.ai/v1/chat/inbound")
.header("API-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"customer_id\": \"+15551112222\",\n \"content\": \"Hi, I need help.\",\n \"session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.osvi.ai/v1/chat/inbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["API-Token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"customer_id\": \"+15551112222\",\n \"content\": \"Hi, I need help.\",\n \"session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8",
"reply": "Sure — I can help with that. What's your order number?",
"state": "default",
"mode": "ai",
"help_requested": false
}
}{
"success": false,
"error": "agent_not_found"
}{
"success": false,
"error": "agent_not_found"
}{
"success": false,
"error": "agent_not_found"
}{
"success": false,
"error": "agent_not_found"
}{
"success": false,
"error": "Python engine returned 422 for POST /v1/chat/session/{id}/support",
"upstream_body": {
"state": "rejected",
"reason": "tell_not_allowed_during_takeover"
}
}Authorizations
16-character API token associated with your OSVI account. Find it in your dashboard under Settings → API.
Body
Unique identifier of the agent handling the conversation.
"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og"
Your identifier for the customer sending the message. Used to resolve the active session when session_id is omitted.
"+15551112222"
The customer's message text.
"Hi, I need help."
Optional session UUID to route the message to. If omitted, the engine resolves the active/new session for the customer + agent.
"4718a326-417b-4dda-90d0-21fd65a11cb8"
