Send Message
curl --request POST \
--url https://api.example.com/chat \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"externalUserIdentifier": "<string>",
"chatHistory": [
{}
],
"conversationId": "<string>",
"integrations": [
"<string>"
],
"useAllIntegrations": true,
"mode": "<string>",
"agentId": "<string>",
"privacyMode": true,
"passthroughMode": true
}
'import requests
url = "https://api.example.com/chat"
payload = {
"message": "<string>",
"externalUserIdentifier": "<string>",
"chatHistory": [{}],
"conversationId": "<string>",
"integrations": ["<string>"],
"useAllIntegrations": True,
"mode": "<string>",
"agentId": "<string>",
"privacyMode": True,
"passthroughMode": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
message: '<string>',
externalUserIdentifier: '<string>',
chatHistory: [{}],
conversationId: '<string>',
integrations: ['<string>'],
useAllIntegrations: true,
mode: '<string>',
agentId: '<string>',
privacyMode: true,
passthroughMode: true
})
};
fetch('https://api.example.com/chat', 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.example.com/chat",
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([
'message' => '<string>',
'externalUserIdentifier' => '<string>',
'chatHistory' => [
[
]
],
'conversationId' => '<string>',
'integrations' => [
'<string>'
],
'useAllIntegrations' => true,
'mode' => '<string>',
'agentId' => '<string>',
'privacyMode' => true,
'passthroughMode' => true
]),
CURLOPT_HTTPHEADER => [
"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.example.com/chat"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"externalUserIdentifier\": \"<string>\",\n \"chatHistory\": [\n {}\n ],\n \"conversationId\": \"<string>\",\n \"integrations\": [\n \"<string>\"\n ],\n \"useAllIntegrations\": true,\n \"mode\": \"<string>\",\n \"agentId\": \"<string>\",\n \"privacyMode\": true,\n \"passthroughMode\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/chat")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"externalUserIdentifier\": \"<string>\",\n \"chatHistory\": [\n {}\n ],\n \"conversationId\": \"<string>\",\n \"integrations\": [\n \"<string>\"\n ],\n \"useAllIntegrations\": true,\n \"mode\": \"<string>\",\n \"agentId\": \"<string>\",\n \"privacyMode\": true,\n \"passthroughMode\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"externalUserIdentifier\": \"<string>\",\n \"chatHistory\": [\n {}\n ],\n \"conversationId\": \"<string>\",\n \"integrations\": [\n \"<string>\"\n ],\n \"useAllIntegrations\": true,\n \"mode\": \"<string>\",\n \"agentId\": \"<string>\",\n \"privacyMode\": true,\n \"passthroughMode\": true\n}"
response = http.request(request)
puts response.read_body{
"answer": "Based on our analysis of recent data, your revenue shows a positive trend with a 15% growth rate over the last quarter...",
"thoughts": "Analyzing revenue data from multiple sources including Google Analytics and Zoho CRM...",
"actions": [
{
"tool": "google_analytics",
"toolInput": "query_revenue_metrics",
"log": "Retrieved revenue metrics for last quarter"
},
{
"tool": "zoho_crm",
"toolInput": "get_sales_pipeline",
"log": "Analyzed sales pipeline data"
}
],
"followUpQuestion": "Would you like to see a breakdown of revenue by product category?",
"reasoning": "The growth is primarily driven by increased enterprise sales and successful product launches",
"conversationId": "conv_123abc",
"timestamp": 1625097600000
}
Chat
Send Message
Send a message to the business analyst
POST
/
chat
Send Message
curl --request POST \
--url https://api.example.com/chat \
--header 'Content-Type: application/json' \
--data '
{
"message": "<string>",
"externalUserIdentifier": "<string>",
"chatHistory": [
{}
],
"conversationId": "<string>",
"integrations": [
"<string>"
],
"useAllIntegrations": true,
"mode": "<string>",
"agentId": "<string>",
"privacyMode": true,
"passthroughMode": true
}
'import requests
url = "https://api.example.com/chat"
payload = {
"message": "<string>",
"externalUserIdentifier": "<string>",
"chatHistory": [{}],
"conversationId": "<string>",
"integrations": ["<string>"],
"useAllIntegrations": True,
"mode": "<string>",
"agentId": "<string>",
"privacyMode": True,
"passthroughMode": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
message: '<string>',
externalUserIdentifier: '<string>',
chatHistory: [{}],
conversationId: '<string>',
integrations: ['<string>'],
useAllIntegrations: true,
mode: '<string>',
agentId: '<string>',
privacyMode: true,
passthroughMode: true
})
};
fetch('https://api.example.com/chat', 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.example.com/chat",
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([
'message' => '<string>',
'externalUserIdentifier' => '<string>',
'chatHistory' => [
[
]
],
'conversationId' => '<string>',
'integrations' => [
'<string>'
],
'useAllIntegrations' => true,
'mode' => '<string>',
'agentId' => '<string>',
'privacyMode' => true,
'passthroughMode' => true
]),
CURLOPT_HTTPHEADER => [
"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.example.com/chat"
payload := strings.NewReader("{\n \"message\": \"<string>\",\n \"externalUserIdentifier\": \"<string>\",\n \"chatHistory\": [\n {}\n ],\n \"conversationId\": \"<string>\",\n \"integrations\": [\n \"<string>\"\n ],\n \"useAllIntegrations\": true,\n \"mode\": \"<string>\",\n \"agentId\": \"<string>\",\n \"privacyMode\": true,\n \"passthroughMode\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
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.example.com/chat")
.header("Content-Type", "application/json")
.body("{\n \"message\": \"<string>\",\n \"externalUserIdentifier\": \"<string>\",\n \"chatHistory\": [\n {}\n ],\n \"conversationId\": \"<string>\",\n \"integrations\": [\n \"<string>\"\n ],\n \"useAllIntegrations\": true,\n \"mode\": \"<string>\",\n \"agentId\": \"<string>\",\n \"privacyMode\": true,\n \"passthroughMode\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"message\": \"<string>\",\n \"externalUserIdentifier\": \"<string>\",\n \"chatHistory\": [\n {}\n ],\n \"conversationId\": \"<string>\",\n \"integrations\": [\n \"<string>\"\n ],\n \"useAllIntegrations\": true,\n \"mode\": \"<string>\",\n \"agentId\": \"<string>\",\n \"privacyMode\": true,\n \"passthroughMode\": true\n}"
response = http.request(request)
puts response.read_body{
"answer": "Based on our analysis of recent data, your revenue shows a positive trend with a 15% growth rate over the last quarter...",
"thoughts": "Analyzing revenue data from multiple sources including Google Analytics and Zoho CRM...",
"actions": [
{
"tool": "google_analytics",
"toolInput": "query_revenue_metrics",
"log": "Retrieved revenue metrics for last quarter"
},
{
"tool": "zoho_crm",
"toolInput": "get_sales_pipeline",
"log": "Analyzed sales pipeline data"
}
],
"followUpQuestion": "Would you like to see a breakdown of revenue by product category?",
"reasoning": "The growth is primarily driven by increased enterprise sales and successful product launches",
"conversationId": "conv_123abc",
"timestamp": 1625097600000
}
Send a message to the business analyst and receive an analyzed response.
Request
string
required
The message to analyze
string
required
Unique identifier for the user in your system
array
Previous messages in the conversation
{
role: 'user' | 'assistant' | 'system'
content: string
metadata?: {
mode?: 'chat' | 'business_analyst'
agentId?: string
thoughts?: string
reasoning?: string
actions?: Array<{
tool: string
toolInput: string
log: string
}>
followUpQuestion?: string
}
timestamp?: number
}[]
string
ID of an existing conversation to continue
string[]
List of specific integrations to use
boolean
default:"true"
Whether to use all available integrations
string
default:"business_analyst"
Mode of operation (‘chat’ or ‘business_analyst’)
string
ID of a specific agent to use
boolean
default:"false"
Whether to store conversation history
boolean
default:"false"
Whether to use passthrough integrations
Response
string
The analyzed response to the message
string
The agent’s thought process
array
Actions taken by the agent
{
tool: string
toolInput: string
log: string
}[]
string
Suggested follow-up question
string
Reasoning behind the analysis
string
ID of the conversation
number
Unix timestamp of the response
Example
curl -X POST https://suada.ai/api/public/chat \
-H "Authorization: Bearer sk-suada-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"message": "What's our revenue trend?",
"externalUserIdentifier": "user-123",
"useAllIntegrations": true,
"mode": "business_analyst"
}'
import { Suada } from '@suada/node';
const suada = new Suada({
apiKey: 'your-api-key'
});
const response = await suada.chat({
message: "What's our revenue trend?",
externalUserIdentifier: 'user-123',
useAllIntegrations: true,
mode: 'business_analyst'
});
from suada import Suada, SuadaConfig, ChatPayload
suada = Suada(
config=SuadaConfig(
api_key="your-api-key"
)
)
response = suada.chat(
payload=ChatPayload(
message="What's our revenue trend?",
external_user_identifier="user-123",
use_all_integrations=True,
mode="business_analyst"
)
)
{
"answer": "Based on our analysis of recent data, your revenue shows a positive trend with a 15% growth rate over the last quarter...",
"thoughts": "Analyzing revenue data from multiple sources including Google Analytics and Zoho CRM...",
"actions": [
{
"tool": "google_analytics",
"toolInput": "query_revenue_metrics",
"log": "Retrieved revenue metrics for last quarter"
},
{
"tool": "zoho_crm",
"toolInput": "get_sales_pipeline",
"log": "Analyzed sales pipeline data"
}
],
"followUpQuestion": "Would you like to see a breakdown of revenue by product category?",
"reasoning": "The growth is primarily driven by increased enterprise sales and successful product launches",
"conversationId": "conv_123abc",
"timestamp": 1625097600000
}
Error Codes
object
Authentication error
{
"error": "Invalid or expired API key"
}
object
Permission error
{
"error": "Insufficient permissions"
}
object
Rate limit exceeded
{
"error": "Too many requests, please try again later.",
"retryAfter": 60
}
Notes
- The conversation history is automatically stored unless
privacyModeis enabled - When
useAllIntegrationsis true, the agent will use all available integrations for the user/organization - The
modeparameter determines how the message is processed:business_analyst: Full analysis with integrationschat: Simple chat response without integration data
- Rate limits apply based on your plan (see Rate Limiting)
Was this page helpful?
⌘I