curl --request POST \
--url https://your-instance.example.com/api/ai/process \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conversationId": "64d2f9c5e8a1d4e001a0b1c2",
"mergeContextPrompt": "The lead just toured the property and is comparing two units."
}
'import requests
url = "https://your-instance.example.com/api/ai/process"
payload = {
"conversationId": "64d2f9c5e8a1d4e001a0b1c2",
"mergeContextPrompt": "The lead just toured the property and is comparing two units."
}
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({
conversationId: '64d2f9c5e8a1d4e001a0b1c2',
mergeContextPrompt: 'The lead just toured the property and is comparing two units.'
})
};
fetch('https://your-instance.example.com/api/ai/process', 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://your-instance.example.com/api/ai/process",
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([
'conversationId' => '64d2f9c5e8a1d4e001a0b1c2',
'mergeContextPrompt' => 'The lead just toured the property and is comparing two units.'
]),
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://your-instance.example.com/api/ai/process"
payload := strings.NewReader("{\n \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"mergeContextPrompt\": \"The lead just toured the property and is comparing two units.\"\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://your-instance.example.com/api/ai/process")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"mergeContextPrompt\": \"The lead just toured the property and is comparing two units.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/ai/process")
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 \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"mergeContextPrompt\": \"The lead just toured the property and is comparing two units.\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Hi Alex — thanks for reaching out! Are you still interested in the Maple Court corner unit?"
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}Generate AI response for conversation
Generates an AI reply for an existing conversation and writes the message back into the conversation. Caller must own the conversation, be assigned to it, or be an ADMIN/SUPERADMIN. Supports optional mergeContextPrompt, followUpProcess, and enableTools overrides.
curl --request POST \
--url https://your-instance.example.com/api/ai/process \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conversationId": "64d2f9c5e8a1d4e001a0b1c2",
"mergeContextPrompt": "The lead just toured the property and is comparing two units."
}
'import requests
url = "https://your-instance.example.com/api/ai/process"
payload = {
"conversationId": "64d2f9c5e8a1d4e001a0b1c2",
"mergeContextPrompt": "The lead just toured the property and is comparing two units."
}
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({
conversationId: '64d2f9c5e8a1d4e001a0b1c2',
mergeContextPrompt: 'The lead just toured the property and is comparing two units.'
})
};
fetch('https://your-instance.example.com/api/ai/process', 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://your-instance.example.com/api/ai/process",
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([
'conversationId' => '64d2f9c5e8a1d4e001a0b1c2',
'mergeContextPrompt' => 'The lead just toured the property and is comparing two units.'
]),
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://your-instance.example.com/api/ai/process"
payload := strings.NewReader("{\n \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"mergeContextPrompt\": \"The lead just toured the property and is comparing two units.\"\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://your-instance.example.com/api/ai/process")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"mergeContextPrompt\": \"The lead just toured the property and is comparing two units.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/ai/process")
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 \"conversationId\": \"64d2f9c5e8a1d4e001a0b1c2\",\n \"mergeContextPrompt\": \"The lead just toured the property and is comparing two units.\"\n}"
response = http.request(request)
puts response.read_body{
"message": "Hi Alex — thanks for reaching out! Are you still interested in the Maple Court corner unit?"
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}{
"success": false,
"error": "approval_expired",
"message": "This approval request has expired or was already handled. Please send a new playground message to retry."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Target conversation to generate a reply for. Caller must own it, be assigned, or be ADMIN/SUPERADMIN. The literal value new-sms is rejected.
Free-form context to splice into the system prompt for this single turn (e.g. tour notes, lead status) without modifying the saved prompt.
Response
AI response generated
Returned by /api/ai/process after the AI reply has been generated and persisted into the conversation.
The generated assistant message text that was appended to the conversation.