Agent Chat Completion (GHL-Safe)
curl --request POST \
--url https://api.assistable.ai/v2/ghl-chat-completion \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conversation_id": "<string>",
"contact_id": "<string>",
"last_message_id": "<string>",
"channel": "<string>",
"input": "<string>",
"location_id": "<string>",
"assistant_id": "<string>",
"messages": [
{}
]
}
'import requests
url = "https://api.assistable.ai/v2/ghl-chat-completion"
payload = {
"conversation_id": "<string>",
"contact_id": "<string>",
"last_message_id": "<string>",
"channel": "<string>",
"input": "<string>",
"location_id": "<string>",
"assistant_id": "<string>",
"messages": [{}]
}
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({
conversation_id: '<string>',
contact_id: '<string>',
last_message_id: '<string>',
channel: '<string>',
input: '<string>',
location_id: '<string>',
assistant_id: '<string>',
messages: [{}]
})
};
fetch('https://api.assistable.ai/v2/ghl-chat-completion', 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.assistable.ai/v2/ghl-chat-completion",
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([
'conversation_id' => '<string>',
'contact_id' => '<string>',
'last_message_id' => '<string>',
'channel' => '<string>',
'input' => '<string>',
'location_id' => '<string>',
'assistant_id' => '<string>',
'messages' => [
[
]
]
]),
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://api.assistable.ai/v2/ghl-chat-completion"
payload := strings.NewReader("{\n \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"last_message_id\": \"<string>\",\n \"channel\": \"<string>\",\n \"input\": \"<string>\",\n \"location_id\": \"<string>\",\n \"assistant_id\": \"<string>\",\n \"messages\": [\n {}\n ]\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://api.assistable.ai/v2/ghl-chat-completion")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"last_message_id\": \"<string>\",\n \"channel\": \"<string>\",\n \"input\": \"<string>\",\n \"location_id\": \"<string>\",\n \"assistant_id\": \"<string>\",\n \"messages\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.assistable.ai/v2/ghl-chat-completion")
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 \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"last_message_id\": \"<string>\",\n \"channel\": \"<string>\",\n \"input\": \"<string>\",\n \"location_id\": \"<string>\",\n \"assistant_id\": \"<string>\",\n \"messages\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"run": {
"response": {
"messages": [
{
"role": "<string>",
"content": "<string>",
"refusal": "<string>",
"annotations": [
{}
]
}
],
"toolCalls": [
{}
],
"completionTimestamp": "2023-11-07T05:31:56Z"
},
"message": {
"conversationId": "<string>",
"messageId": "<string>",
"traceId": "<string>"
},
"knowledge_base": {
"matches": [
{
"id": "<string>",
"score": 123,
"values": [
{}
],
"metadata": {
"text": "<string>"
}
}
],
"namespace": "<string>",
"usage": {
"readUnits": 123
}
},
"input": "<string>",
"output": "<string>"
}
}API Reference
Agent Chat Completion (GHL-Safe)
POST
/
v2
/
ghl-chat-completion
Agent Chat Completion (GHL-Safe)
curl --request POST \
--url https://api.assistable.ai/v2/ghl-chat-completion \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conversation_id": "<string>",
"contact_id": "<string>",
"last_message_id": "<string>",
"channel": "<string>",
"input": "<string>",
"location_id": "<string>",
"assistant_id": "<string>",
"messages": [
{}
]
}
'import requests
url = "https://api.assistable.ai/v2/ghl-chat-completion"
payload = {
"conversation_id": "<string>",
"contact_id": "<string>",
"last_message_id": "<string>",
"channel": "<string>",
"input": "<string>",
"location_id": "<string>",
"assistant_id": "<string>",
"messages": [{}]
}
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({
conversation_id: '<string>',
contact_id: '<string>',
last_message_id: '<string>',
channel: '<string>',
input: '<string>',
location_id: '<string>',
assistant_id: '<string>',
messages: [{}]
})
};
fetch('https://api.assistable.ai/v2/ghl-chat-completion', 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.assistable.ai/v2/ghl-chat-completion",
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([
'conversation_id' => '<string>',
'contact_id' => '<string>',
'last_message_id' => '<string>',
'channel' => '<string>',
'input' => '<string>',
'location_id' => '<string>',
'assistant_id' => '<string>',
'messages' => [
[
]
]
]),
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://api.assistable.ai/v2/ghl-chat-completion"
payload := strings.NewReader("{\n \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"last_message_id\": \"<string>\",\n \"channel\": \"<string>\",\n \"input\": \"<string>\",\n \"location_id\": \"<string>\",\n \"assistant_id\": \"<string>\",\n \"messages\": [\n {}\n ]\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://api.assistable.ai/v2/ghl-chat-completion")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"last_message_id\": \"<string>\",\n \"channel\": \"<string>\",\n \"input\": \"<string>\",\n \"location_id\": \"<string>\",\n \"assistant_id\": \"<string>\",\n \"messages\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.assistable.ai/v2/ghl-chat-completion")
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 \"conversation_id\": \"<string>\",\n \"contact_id\": \"<string>\",\n \"last_message_id\": \"<string>\",\n \"channel\": \"<string>\",\n \"input\": \"<string>\",\n \"location_id\": \"<string>\",\n \"assistant_id\": \"<string>\",\n \"messages\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"run": {
"response": {
"messages": [
{
"role": "<string>",
"content": "<string>",
"refusal": "<string>",
"annotations": [
{}
]
}
],
"toolCalls": [
{}
],
"completionTimestamp": "2023-11-07T05:31:56Z"
},
"message": {
"conversationId": "<string>",
"messageId": "<string>",
"traceId": "<string>"
},
"knowledge_base": {
"matches": [
{
"id": "<string>",
"score": 123,
"values": [
{}
],
"metadata": {
"text": "<string>"
}
}
],
"namespace": "<string>",
"usage": {
"readUnits": 123
}
},
"input": "<string>",
"output": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
ID of the conversation
ID of the contact
ID of the last message
Communication channel
User input text
Location ID
ID of the assistant
Message history
Response
200 - application/json
Chat completion successful
Show child attributes
Show child attributes
