> ## Documentation Index
> Fetch the complete documentation index at: https://docs.suada.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Message

> Send a message to the business analyst

Send a message to the business analyst and receive an analyzed response.

## Request

<ParamField body="message" type="string" required>
  The message to analyze
</ParamField>

<ParamField body="externalUserIdentifier" type="string" required>
  Unique identifier for the user in your system
</ParamField>

<ParamField body="chatHistory" type="array">
  Previous messages in the conversation

  ```ts theme={null}
  {
    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
  }[]
  ```
</ParamField>

<ParamField body="conversationId" type="string">
  ID of an existing conversation to continue
</ParamField>

<ParamField body="integrations" type="string[]">
  List of specific integrations to use
</ParamField>

<ParamField body="useAllIntegrations" type="boolean" default="true">
  Whether to use all available integrations
</ParamField>

<ParamField body="mode" type="string" default="business_analyst">
  Mode of operation ('chat' or 'business\_analyst')
</ParamField>

<ParamField body="agentId" type="string">
  ID of a specific agent to use
</ParamField>

<ParamField body="privacyMode" type="boolean" default="false">
  Whether to store conversation history
</ParamField>

<ParamField body="passthroughMode" type="boolean" default="false">
  Whether to use passthrough integrations
</ParamField>

## Response

<ResponseField name="answer" type="string">
  The analyzed response to the message
</ResponseField>

<ResponseField name="thoughts" type="string">
  The agent's thought process
</ResponseField>

<ResponseField name="actions" type="array">
  Actions taken by the agent

  ```ts theme={null}
  {
    tool: string
    toolInput: string
    log: string
  }[]
  ```
</ResponseField>

<ResponseField name="followUpQuestion" type="string">
  Suggested follow-up question
</ResponseField>

<ResponseField name="reasoning" type="string">
  Reasoning behind the analysis
</ResponseField>

<ResponseField name="conversationId" type="string">
  ID of the conversation
</ResponseField>

<ResponseField name="timestamp" type="number">
  Unix timestamp of the response
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  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"
    }'
  ```

  ```typescript TypeScript theme={null}
  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'
  });
  ```

  ```python Python theme={null}
  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"
      )
  )
  ```
</CodeGroup>

<ResponseExample>
  ```json theme={null}
  {
    "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
  }
  ```
</ResponseExample>

## Error Codes

<ResponseField name="401" type="object">
  Authentication error

  ```json theme={null}
  {
    "error": "Invalid or expired API key"
  }
  ```
</ResponseField>

<ResponseField name="403" type="object">
  Permission error

  ```json theme={null}
  {
    "error": "Insufficient permissions"
  }
  ```
</ResponseField>

<ResponseField name="429" type="object">
  Rate limit exceeded

  ```json theme={null}
  {
    "error": "Too many requests, please try again later.",
    "retryAfter": 60
  }
  ```
</ResponseField>

## Notes

* The conversation history is automatically stored unless `privacyMode` is enabled
* When `useAllIntegrations` is true, the agent will use all available integrations for the user/organization
* The `mode` parameter determines how the message is processed:
  * `business_analyst`: Full analysis with integrations
  * `chat`: Simple chat response without integration data
* Rate limits apply based on your plan (see [Rate Limiting](/api-reference/overview#rate-limiting))
