Send a chat message
curl --request POST \
--url https://api.osvi.ai/chat_messages/send_message \
--header 'API-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"chat_session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8",
"message": "What are your business hours?"
}
'import requests
url = "https://api.osvi.ai/chat_messages/send_message"
payload = {
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"chat_session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8",
"message": "What are your business hours?"
}
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',
chat_session_id: '4718a326-417b-4dda-90d0-21fd65a11cb8',
message: 'What are your business hours?'
})
};
fetch('https://api.osvi.ai/chat_messages/send_message', 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/chat_messages/send_message",
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',
'chat_session_id' => '4718a326-417b-4dda-90d0-21fd65a11cb8',
'message' => 'What are your business hours?'
]),
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/chat_messages/send_message"
payload := strings.NewReader("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"chat_session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\",\n \"message\": \"What are your business hours?\"\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/chat_messages/send_message")
.header("API-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"chat_session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\",\n \"message\": \"What are your business hours?\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.osvi.ai/chat_messages/send_message")
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 \"chat_session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\",\n \"message\": \"What are your business hours?\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8",
"response": "We're open Monday to Friday, 9 AM to 6 PM IST.",
"tool_calls": [
"<unknown>"
],
"tool_results": [
"<unknown>"
],
"current_state": null
}
}{
"success": false,
"error": "Invalid API token"
}{
"success": false,
"errors": [
"agent_uuid is required",
"phone_number is invalid"
]
}Chat
Send Chat Message
deprecated
Legacy — will be deprecated soon. Use the Chat v1 endpoint (POST /v1/chat/inbound) for new integrations.
Sends a user message to an active chat session and returns the agent’s response synchronously.
POST
/
chat_messages
/
send_message
Send a chat message
curl --request POST \
--url https://api.osvi.ai/chat_messages/send_message \
--header 'API-Token: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"chat_session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8",
"message": "What are your business hours?"
}
'import requests
url = "https://api.osvi.ai/chat_messages/send_message"
payload = {
"agent_uuid": "agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og",
"chat_session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8",
"message": "What are your business hours?"
}
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',
chat_session_id: '4718a326-417b-4dda-90d0-21fd65a11cb8',
message: 'What are your business hours?'
})
};
fetch('https://api.osvi.ai/chat_messages/send_message', 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/chat_messages/send_message",
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',
'chat_session_id' => '4718a326-417b-4dda-90d0-21fd65a11cb8',
'message' => 'What are your business hours?'
]),
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/chat_messages/send_message"
payload := strings.NewReader("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"chat_session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\",\n \"message\": \"What are your business hours?\"\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/chat_messages/send_message")
.header("API-Token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_uuid\": \"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og\",\n \"chat_session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\",\n \"message\": \"What are your business hours?\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.osvi.ai/chat_messages/send_message")
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 \"chat_session_id\": \"4718a326-417b-4dda-90d0-21fd65a11cb8\",\n \"message\": \"What are your business hours?\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"session_id": "4718a326-417b-4dda-90d0-21fd65a11cb8",
"response": "We're open Monday to Friday, 9 AM to 6 PM IST.",
"tool_calls": [
"<unknown>"
],
"tool_results": [
"<unknown>"
],
"current_state": null
}
}{
"success": false,
"error": "Invalid API token"
}{
"success": false,
"errors": [
"agent_uuid is required",
"phone_number is invalid"
]
}Authorizations
16-character API token associated with your OSVI account. Find it in your dashboard under Settings → API.
Body
application/json
Unique identifier of the agent handling the session.
Example:
"agent_IsZ3Q6Sf_60Eh26XQMGbz-R_og"
Session ID returned by the Start Chat Session endpoint.
Example:
"4718a326-417b-4dda-90d0-21fd65a11cb8"
The user's message.
Example:
"What are your business hours?"
⌘I
