v1

latestOpenAPI 3.0.22026-07-174617345.8 KB
Conversations

Send a message to a conversation.

Send a message to a conversation within an agent (formerly known as project) identified by its unique projectId and sessionId. This endpoint enables you to send a new message to a specific conversation, facilitating seamless communication and collaboration within the agent. By providing the projectId and sessionId, you can target the desired conversation and contribute to the ongoing discussion. This API endpoint supports real-time streaming, allowing for instant message delivery and dynamic updates which enables efficient and interactive communication between the user and agent. Here is an example to send a message to a conversation: API SDK.

post/api/v1/projects/{projectId}/conversations/{sessionId}/messages

Path parameters

projectIdinteger required
Example:1

The ID of the agent to get the messages for

sessionIdstring required
Example:1

The session ID of the converstaions to get the messages for

Query parameters

streamboolean

Whether to stream the response or not, if stream the responses will be sent as data-only server-sent events as they become available, with the stream terminated by a status: "finish" message. Example Python code.

langstring

The language to use for the prompt

external_idstring

The external ID of the prompt history.

Request body

promptstring

Prompt to send to OpenAI

custom_personastring nullable

Custom persona to use for the conversation

chatbot_model'gpt-4-o' | 'gpt-4-1' | 'gpt-4o-mini' | 'gpt-4-1-mini' | 'claude-3-sonnet' | 'claude-3.5-sonnet' | 'gpt-o4-mini-low' | 'gpt-o4-mini-medium' | 'gpt-o4-mini-high' nullable

Agent model to use for the conversation

response_source'default' | 'own_content' | 'openai_content' nullable

By default, we ask ChatGPT to use only your content in its response (recommended). If you wish ChatGPT to improvise and use its own knowledgebase as well, you can set this to "openai_content".

Example request

{
  "prompt": "Write me hello world program in C",
  "custom_persona": "You are a custom AI Agent called *agent name*, a friendly *agent role* who works for *organization* and answers questions based on the given context. Be as helpful as possible. Always prioritize the customer. Escalate complex issues. Stay on topic. Use appropriate language, Acknowledge limitations.",
  "chatbot_model": "gpt-4-o",
  "response_source": "default"
}

Response

Send a message to a conversation

status'error' | 'success'

The status of the response

Example response

{
  "status": "success",
  "data": {
    "id": 1,
    "user_id": 1,
    "user_query": "What is the meaning of life?",
    "openai_response": "The meaning of life is to be happy.",
    "created_at": "2021-01-01 00:00:00",
    "updated_at": "2021-01-01 00:00:00",
    "conversation_id": 1,
    "citations": [
      1,
      2,
      3
    ],
    "metadata": {
      "user_ip": "127.0.0.1",
      "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko)",
      "external_id": "ext_id_1234567890",
      "request_source": "web"
    },
    "response_feedback": {
      "created_at": "2024-08-27T21:07:20.000000Z",
      "updated_at": "2024-08-27T21:07:20.000000Z",
      "user_id": 1,
      "reaction": "liked"
    }
  }
}