curl --request POST \
--url https://app.livechatai.com/api/v2/conversations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"question": "What are your business hours?",
"agentId": "clx1234567890abcdef",
"contactId": "contact_1234567890",
"conversationId": "chat_1234567890",
"messageType": "TEXT",
"attachments": [
{
"url": "https://cdn.example.com/bot/chat/abc/messages/file.pdf",
"name": "report.pdf",
"mimeType": "application/pdf",
"size": 123
}
],
"streaming": false,
"ip": "192.168.1.1",
"country": "US",
"responseFormat": "MARKDOWN",
"integrationType": "WHATSAPP"
}
'import requests
url = "https://app.livechatai.com/api/v2/conversations"
payload = {
"question": "What are your business hours?",
"agentId": "clx1234567890abcdef",
"contactId": "contact_1234567890",
"conversationId": "chat_1234567890",
"messageType": "TEXT",
"attachments": [
{
"url": "https://cdn.example.com/bot/chat/abc/messages/file.pdf",
"name": "report.pdf",
"mimeType": "application/pdf",
"size": 123
}
],
"streaming": False,
"ip": "192.168.1.1",
"country": "US",
"responseFormat": "MARKDOWN",
"integrationType": "WHATSAPP"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
question: 'What are your business hours?',
agentId: 'clx1234567890abcdef',
contactId: 'contact_1234567890',
conversationId: 'chat_1234567890',
messageType: 'TEXT',
attachments: [
{
url: 'https://cdn.example.com/bot/chat/abc/messages/file.pdf',
name: 'report.pdf',
mimeType: 'application/pdf',
size: 123
}
],
streaming: false,
ip: '192.168.1.1',
country: 'US',
responseFormat: 'MARKDOWN',
integrationType: 'WHATSAPP'
})
};
fetch('https://app.livechatai.com/api/v2/conversations', 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://app.livechatai.com/api/v2/conversations",
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([
'question' => 'What are your business hours?',
'agentId' => 'clx1234567890abcdef',
'contactId' => 'contact_1234567890',
'conversationId' => 'chat_1234567890',
'messageType' => 'TEXT',
'attachments' => [
[
'url' => 'https://cdn.example.com/bot/chat/abc/messages/file.pdf',
'name' => 'report.pdf',
'mimeType' => 'application/pdf',
'size' => 123
]
],
'streaming' => false,
'ip' => '192.168.1.1',
'country' => 'US',
'responseFormat' => 'MARKDOWN',
'integrationType' => 'WHATSAPP'
]),
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://app.livechatai.com/api/v2/conversations"
payload := strings.NewReader("{\n \"question\": \"What are your business hours?\",\n \"agentId\": \"clx1234567890abcdef\",\n \"contactId\": \"contact_1234567890\",\n \"conversationId\": \"chat_1234567890\",\n \"messageType\": \"TEXT\",\n \"attachments\": [\n {\n \"url\": \"https://cdn.example.com/bot/chat/abc/messages/file.pdf\",\n \"name\": \"report.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 123\n }\n ],\n \"streaming\": false,\n \"ip\": \"192.168.1.1\",\n \"country\": \"US\",\n \"responseFormat\": \"MARKDOWN\",\n \"integrationType\": \"WHATSAPP\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://app.livechatai.com/api/v2/conversations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"question\": \"What are your business hours?\",\n \"agentId\": \"clx1234567890abcdef\",\n \"contactId\": \"contact_1234567890\",\n \"conversationId\": \"chat_1234567890\",\n \"messageType\": \"TEXT\",\n \"attachments\": [\n {\n \"url\": \"https://cdn.example.com/bot/chat/abc/messages/file.pdf\",\n \"name\": \"report.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 123\n }\n ],\n \"streaming\": false,\n \"ip\": \"192.168.1.1\",\n \"country\": \"US\",\n \"responseFormat\": \"MARKDOWN\",\n \"integrationType\": \"WHATSAPP\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.livechatai.com/api/v2/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"question\": \"What are your business hours?\",\n \"agentId\": \"clx1234567890abcdef\",\n \"contactId\": \"contact_1234567890\",\n \"conversationId\": \"chat_1234567890\",\n \"messageType\": \"TEXT\",\n \"attachments\": [\n {\n \"url\": \"https://cdn.example.com/bot/chat/abc/messages/file.pdf\",\n \"name\": \"report.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 123\n }\n ],\n \"streaming\": false,\n \"ip\": \"192.168.1.1\",\n \"country\": \"US\",\n \"responseFormat\": \"MARKDOWN\",\n \"integrationType\": \"WHATSAPP\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Message sent successfully",
"data": {
"conversationId": "chat_1234567890",
"contactId": "contact_1234567890",
"response": "Our business hours are Monday to Friday, 9 AM to 6 PM EST.",
"messageId": "msg_1234567890",
"responseMessageId": "msg_0987654321",
"links": [
{
"link": "https://example.com/page",
"type": "WEBSITE"
}
]
}
}Send a message
Send a message to start or continue a conversation with an agent
curl --request POST \
--url https://app.livechatai.com/api/v2/conversations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"question": "What are your business hours?",
"agentId": "clx1234567890abcdef",
"contactId": "contact_1234567890",
"conversationId": "chat_1234567890",
"messageType": "TEXT",
"attachments": [
{
"url": "https://cdn.example.com/bot/chat/abc/messages/file.pdf",
"name": "report.pdf",
"mimeType": "application/pdf",
"size": 123
}
],
"streaming": false,
"ip": "192.168.1.1",
"country": "US",
"responseFormat": "MARKDOWN",
"integrationType": "WHATSAPP"
}
'import requests
url = "https://app.livechatai.com/api/v2/conversations"
payload = {
"question": "What are your business hours?",
"agentId": "clx1234567890abcdef",
"contactId": "contact_1234567890",
"conversationId": "chat_1234567890",
"messageType": "TEXT",
"attachments": [
{
"url": "https://cdn.example.com/bot/chat/abc/messages/file.pdf",
"name": "report.pdf",
"mimeType": "application/pdf",
"size": 123
}
],
"streaming": False,
"ip": "192.168.1.1",
"country": "US",
"responseFormat": "MARKDOWN",
"integrationType": "WHATSAPP"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
question: 'What are your business hours?',
agentId: 'clx1234567890abcdef',
contactId: 'contact_1234567890',
conversationId: 'chat_1234567890',
messageType: 'TEXT',
attachments: [
{
url: 'https://cdn.example.com/bot/chat/abc/messages/file.pdf',
name: 'report.pdf',
mimeType: 'application/pdf',
size: 123
}
],
streaming: false,
ip: '192.168.1.1',
country: 'US',
responseFormat: 'MARKDOWN',
integrationType: 'WHATSAPP'
})
};
fetch('https://app.livechatai.com/api/v2/conversations', 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://app.livechatai.com/api/v2/conversations",
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([
'question' => 'What are your business hours?',
'agentId' => 'clx1234567890abcdef',
'contactId' => 'contact_1234567890',
'conversationId' => 'chat_1234567890',
'messageType' => 'TEXT',
'attachments' => [
[
'url' => 'https://cdn.example.com/bot/chat/abc/messages/file.pdf',
'name' => 'report.pdf',
'mimeType' => 'application/pdf',
'size' => 123
]
],
'streaming' => false,
'ip' => '192.168.1.1',
'country' => 'US',
'responseFormat' => 'MARKDOWN',
'integrationType' => 'WHATSAPP'
]),
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://app.livechatai.com/api/v2/conversations"
payload := strings.NewReader("{\n \"question\": \"What are your business hours?\",\n \"agentId\": \"clx1234567890abcdef\",\n \"contactId\": \"contact_1234567890\",\n \"conversationId\": \"chat_1234567890\",\n \"messageType\": \"TEXT\",\n \"attachments\": [\n {\n \"url\": \"https://cdn.example.com/bot/chat/abc/messages/file.pdf\",\n \"name\": \"report.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 123\n }\n ],\n \"streaming\": false,\n \"ip\": \"192.168.1.1\",\n \"country\": \"US\",\n \"responseFormat\": \"MARKDOWN\",\n \"integrationType\": \"WHATSAPP\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://app.livechatai.com/api/v2/conversations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"question\": \"What are your business hours?\",\n \"agentId\": \"clx1234567890abcdef\",\n \"contactId\": \"contact_1234567890\",\n \"conversationId\": \"chat_1234567890\",\n \"messageType\": \"TEXT\",\n \"attachments\": [\n {\n \"url\": \"https://cdn.example.com/bot/chat/abc/messages/file.pdf\",\n \"name\": \"report.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 123\n }\n ],\n \"streaming\": false,\n \"ip\": \"192.168.1.1\",\n \"country\": \"US\",\n \"responseFormat\": \"MARKDOWN\",\n \"integrationType\": \"WHATSAPP\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.livechatai.com/api/v2/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"question\": \"What are your business hours?\",\n \"agentId\": \"clx1234567890abcdef\",\n \"contactId\": \"contact_1234567890\",\n \"conversationId\": \"chat_1234567890\",\n \"messageType\": \"TEXT\",\n \"attachments\": [\n {\n \"url\": \"https://cdn.example.com/bot/chat/abc/messages/file.pdf\",\n \"name\": \"report.pdf\",\n \"mimeType\": \"application/pdf\",\n \"size\": 123\n }\n ],\n \"streaming\": false,\n \"ip\": \"192.168.1.1\",\n \"country\": \"US\",\n \"responseFormat\": \"MARKDOWN\",\n \"integrationType\": \"WHATSAPP\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Message sent successfully",
"data": {
"conversationId": "chat_1234567890",
"contactId": "contact_1234567890",
"response": "Our business hours are Monday to Friday, 9 AM to 6 PM EST.",
"messageId": "msg_1234567890",
"responseMessageId": "msg_0987654321",
"links": [
{
"link": "https://example.com/page",
"type": "WEBSITE"
}
]
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Message details for the agent
The question or message to send to the agent
"What are your business hours?"
Unique identifier of the agent to message
"clx1234567890abcdef"
Optional: ID of an existing contact to associate with this conversation. If not provided, a new contact may be created automatically.
"contact_1234567890"
Optional: ID of an existing conversation to continue. If provided, the message will be added to the existing conversation. If not provided, a new conversation will be created and returned in the response.
"chat_1234567890"
Type of message being sent. Resolved automatically when attachments are provided (single image -> IMAGE, otherwise FILE).
TEXT, IMAGE, FILE "TEXT"
Optional file attachments. Upload each file to S3 first via the attachments presign endpoint, then reference the returned metadata here.
Show child attributes
Show child attributes
Optional: Enable streaming of the response
false
Optional: Client IP address
"192.168.1.1"
Optional: Client country code
"US"
Optional: Format of the AI response (MARKDOWN or PLAIN text)
MARKDOWN, PLAIN "MARKDOWN"
Optional: Integration type for the conversation
WHATSAPP, SLACK "WHATSAPP"

