Conversations (Public)

Comprehensive guide to managing public conversations and messages in the View Assistant platform, including public conversation creation, message handling, and streaming support for real-time AI interactions.

Overview

Public Conversations enable interactive AI-powered chat sessions within the View Assistant platform for public-facing applications. They provide structured communication channels for users to engage with AI models, send messages, receive streaming responses, and manage conversation history with full support for document attachments and metadata tracking, without requiring full authentication credentials.

Public Conversations are managed via the Assistant API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/assistant/public/conversations and support comprehensive operations including conversation creation, message streaming, pagination, and lifecycle management for optimal public-facing AI interaction workflows.

Conversation Object Structure

Conversation objects contain comprehensive information about chat sessions and their associated metadata. Here's the complete structure:

{
  "conversation_id": "abc123-def456-ghi789",
  "tenant_guid": "00000000-0000-0000-0000-000000000000",
  "user_guid": "11111111-1111-1111-1111-111111111111",
  "session_id": "session-abc-123",
  "config_guid": "22222222-2222-2222-2222-222222222222",
  "title": "Project Planning Discussion",
  "message_count": 15,
  "last_message_at": "2025-01-15T10:30:00.000000Z",
  "created_at": "2025-01-15T09:00:00.000000Z",
  "updated_at": "2025-01-15T10:30:00.000000Z",
  "metadata": {
    "source": "web",
    "user_id": "user-123"
  }
}

Field Descriptions

  • conversation_id (string): Unique identifier for the conversation
  • tenant_guid (string): Globally unique identifier for the tenant
  • user_guid (string): Globally unique identifier for the user
  • session_id (any): Session identifier associated with the conversation
  • config_guid (string): GUID of the model configuration used for this conversation
  • title (string): Display title for the conversation
  • message_count (number): Total number of messages in the conversation
  • last_message_at (any): Timestamp of the last message in the conversation
  • created_at (string): Timestamp when the conversation was created
  • updated_at (string): Timestamp when the conversation was last updated
  • metadata (any): Additional metadata object with flexible structure

Conversation Message Object Structure

Conversation message objects contain detailed information about individual messages within conversations:

{
  "message_id": "msg-001",
  "conversation_id": "abc123-def456-ghi789",
  "role": "user",
  "content": "Hello, I need help with my project.",
  "sources": null,
  "metadata": null,
  "created_at": "2025-01-15T09:00:00.000000Z",
  "is_superseded": false,
  "superseded_at": null,
  "superseded_by_message_id": null,
  "edited_at": null,
  "original_content": null
}

Message Field Descriptions

  • message_id (string): Unique identifier for the message
  • conversation_id (string): ID of the conversation containing this message
  • role (string): Role of the message sender (e.g., "user", "assistant")
  • content (string): Content of the message
  • sources (any): Source documents or references associated with the message
  • metadata (any): Additional metadata for the message
  • created_at (string): Timestamp when the message was created
  • is_superseded (boolean): Whether this message has been superseded by another message
  • superseded_at (any): Timestamp when the message was superseded (if applicable)
  • superseded_by_message_id (any): ID of the message that superseded this one (if applicable)
  • edited_at (any): Timestamp when the message was edited (if applicable)
  • original_content (any): Original content before editing (if applicable)

API Endpoints

Public Conversations are managed via the Assistant server API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/assistant/public/conversations

Supported HTTP Methods: GET, POST, PATCH

Important: Public conversation operations require appropriate authentication tokens. Note that delete operations are not available for public conversations.

Supported Operations

  • Create: Create new public conversations with initial messages and streaming support
  • Read: Retrieve individual conversation details with or without messages
  • Read All: List all conversations with pagination support
  • Update: Modify conversation properties such as title and metadata
  • Read Messages: Retrieve messages from a conversation with pagination
  • Add Messages: Send new messages to conversations with streaming support
  • Update Messages: Modify existing messages in conversations

Create Conversation

Creates a new public conversation using POST /v1.0/tenants/[tenant-guid]/assistant/public/conversations. This endpoint supports streaming responses and creates a new conversation with an initial message.

Request Parameters

  • config_guid (string, Required): GUID of the model configuration to use
  • title (string, Required): Display title for the conversation
  • message (string, Required): Initial message to start the conversation
  • metadata (any, Optional): Additional metadata object with flexible structure
  • documents (any, Optional): Documents to attach to the conversation

Request Body

{
  "config_guid": "22222222-2222-2222-2222-222222222222",
  "title": "New Conversation",
  "message": "Hello, I need help with my project.",
  "metadata": {
    "source": "web",
    "user_id": "user-123"
  },
  "documents": null
}
curl --location --request POST 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/public/conversations' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "config_guid": "22222222-2222-2222-2222-222222222222",
    "title": "New Conversation",
    "message": "Hello, I need help with my project.",
    "metadata": {
        "source": "web",
        "user_id": "user-123"
    }
}'
import { ViewSdk } from "view-sdk";

const api = new ViewSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const createConversation = async () => {
  try {
    const response = await api.PublicConversation.create({
      config_guid: "22222222-2222-2222-2222-222222222222",
      title: "New Conversation",
      message: "Hello, I need help with my project.",
      metadata: {
        source: "web",
        user_id: "user-123"
      }
    }, (token) => {
      // Handle streaming tokens
      console.log("Token:", token);
    });
    console.log(response, "Conversation created successfully");
  } catch (err) {
    console.log("Error creating conversation:", err);
  }
};

createConversation();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def createConversation():
    def on_token(token):
        # Handle streaming tokens
        print("Token:", token)
    
    conversation = assistant.PublicConversation.create(
        config_guid="22222222-2222-2222-2222-222222222222",
        title="New Conversation",
        message="Hello, I need help with my project.",
        metadata={
            "source": "web",
            "user_id": "user-123"
        },
        on_token=on_token
    )
    print("Created Conversation:")
    print(conversation)

createConversation()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

ConversationRequest request = new ConversationRequest
{
    config_guid = "22222222-2222-2222-2222-222222222222",
    title = "New Conversation",
    message = "Hello, I need help with my project.",
    metadata = new Dictionary<string, object>
    {
        { "source", "web" },
        { "user_id", "user-123" }
    }
};

Conversation conversation = await sdk.PublicConversation.Create(request, (token) => {
    // Handle streaming tokens
    Console.WriteLine("Token: {0}", token);
});

Response

Returns the created conversation object with all details:

{
  "conversation_id": "abc123-def456-ghi789",
  "tenant_guid": "00000000-0000-0000-0000-000000000000",
  "user_guid": "11111111-1111-1111-1111-111111111111",
  "session_id": "session-abc-123",
  "config_guid": "22222222-2222-2222-2222-222222222222",
  "title": "New Conversation",
  "message_count": 1,
  "last_message_at": "2025-01-15T09:00:00.000000Z",
  "created_at": "2025-01-15T09:00:00.000000Z",
  "updated_at": "2025-01-15T09:00:00.000000Z",
  "metadata": {
    "source": "web",
    "user_id": "user-123"
  }
}

Note: This endpoint supports streaming responses. Tokens are delivered incrementally via the onToken callback function.

Read Conversation with Messages

Retrieves a specific conversation by ID along with its messages using GET /v1.0/tenants/[tenant-guid]/assistant/public/conversations/[conversation-id]. Returns the complete conversation with paginated messages.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation to retrieve
  • message_limit (number, Query, Optional): Number of messages to retrieve (default: 100)
  • message_offset (number, Query, Optional): Offset for message pagination (default: 0)
curl --location 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/public/conversations/abc123-def456-ghi789?message_limit=100&message_offset=0' \
--header 'Authorization: ••••••'
import { ViewSdk } from "view-sdk";

const api = new ViewSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const readConversation = async () => {
  try {
    const response = await api.PublicConversation.readWithMessages(
      "abc123-def456-ghi789",
      100, // message_limit
      0    // message_offset
    );
    console.log(response, "Conversation fetched successfully");
  } catch (err) {
    console.log("Error fetching conversation:", err);
  }
};

readConversation();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def readConversation():
    conversation = assistant.PublicConversation.read_with_messages(
        conversation_id="abc123-def456-ghi789",
        messages_limit=100,
        messages_offset=0
    )
    print("Retrieved Conversation:")
    print(conversation)

readConversation()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

ConversationWithMessagesResponse response = await sdk.PublicConversation.ReadWithMessages(
    "abc123-def456-ghi789",
    messagesLimit: 100,
    messagesOffset: 0
);

Response

Returns the conversation with associated messages:

{
  "conversation": {
    "conversation_id": "abc123-def456-ghi789",
    "tenant_guid": "00000000-0000-0000-0000-000000000000",
    "user_guid": "11111111-1111-1111-1111-111111111111",
    "session_id": "session-abc-123",
    "config_guid": "22222222-2222-2222-2222-222222222222",
    "title": "Project Planning Discussion",
    "message_count": 15,
    "last_message_at": "2025-01-15T10:30:00.000000Z",
    "created_at": "2025-01-15T09:00:00.000000Z",
    "updated_at": "2025-01-15T10:30:00.000000Z",
    "metadata": {
      "source": "web",
      "user_id": "user-123"
    }
  },
  "messages": [
    {
      "message_id": "msg-001",
      "conversation_id": "abc123-def456-ghi789",
      "role": "user",
      "content": "Hello, I need help with my project.",
      "sources": null,
      "metadata": null,
      "created_at": "2025-01-15T09:00:00.000000Z",
      "is_superseded": false,
      "superseded_at": null,
      "superseded_by_message_id": null,
      "edited_at": null,
      "original_content": null
    },
    {
      "message_id": "msg-002",
      "conversation_id": "abc123-def456-ghi789",
      "role": "assistant",
      "content": "I'd be happy to help you with your project. What specific aspects would you like to discuss?",
      "sources": null,
      "metadata": null,
      "created_at": "2025-01-15T09:00:15.000000Z",
      "is_superseded": false,
      "superseded_at": null,
      "superseded_by_message_id": null,
      "edited_at": null,
      "original_content": null
    }
  ]
}

Read All Conversations

Retrieves all conversations for a tenant using GET /v1.0/tenants/[tenant-guid]/assistant/public/conversations. Returns a paginated list of conversations.

Request Parameters

  • limit (number, Query, Optional): Number of conversations to retrieve (default: 100)
  • offset (number, Query, Optional): Offset for pagination (default: 0)
curl --location 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/public/conversations?limit=100&offset=0' \
--header 'Authorization: ••••••'
import { ViewSdk } from "view-sdk";

const api = new ViewSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const readAllConversations = async () => {
  try {
    const response = await api.PublicConversation.readAll(100, 0);
    console.log(response, "All conversations fetched successfully");
  } catch (err) {
    console.log("Error fetching conversations:", err);
  }
};

readAllConversations();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def readAllConversations():
    conversations = assistant.PublicConversation.read_all(
        limit=100,
        offset=0
    )
    print("All Conversations:")
    print(conversations)

readAllConversations()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

ConversationListResponse response = await sdk.PublicConversation.ReadAll(
    limit: 100,
    offset: 0
);

Response

Returns a paginated list of conversations:

{
  "conversations": [
    {
      "conversation_id": "abc123-def456-ghi789",
      "tenant_guid": "00000000-0000-0000-0000-000000000000",
      "user_guid": "11111111-1111-1111-1111-111111111111",
      "session_id": "session-abc-123",
      "config_guid": "22222222-2222-2222-2222-222222222222",
      "title": "Project Planning Discussion",
      "message_count": 15,
      "last_message_at": "2025-01-15T10:30:00.000000Z",
      "created_at": "2025-01-15T09:00:00.000000Z",
      "updated_at": "2025-01-15T10:30:00.000000Z",
      "metadata": {
        "source": "web",
        "user_id": "user-123"
      }
    }
  ],
  "total": 25,
  "limit": 100,
  "offset": 0
}

Update Conversation

Updates an existing conversation using PATCH /v1.0/tenants/[tenant-guid]/assistant/public/conversations/[conversation-id]. Requires providing the full conversation request object.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation to update

Request Body

Provide the full conversation request object with fields to update:

{
  "config_guid": "22222222-2222-2222-2222-222222222222",
  "title": "Updated Conversation Title",
  "message": "Updated initial message",
  "metadata": {
    "source": "mobile",
    "user_id": "user-456"
  },
  "documents": null
}
curl --location --request PATCH 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/public/conversations/abc123-def456-ghi789' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "config_guid": "22222222-2222-2222-2222-222222222222",
    "title": "Updated Conversation Title",
    "message": "Updated initial message",
    "metadata": {
        "source": "mobile",
        "user_id": "user-456"
    }
}'
import { ViewSdk } from "view-sdk";

const api = new ViewSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const updateConversation = async () => {
  try {
    const response = await api.PublicConversation.update(
      "abc123-def456-ghi789",
      {
        config_guid: "22222222-2222-2222-2222-222222222222",
        title: "Updated Conversation Title",
        message: "Updated initial message",
        metadata: {
          source: "mobile",
          user_id: "user-456"
        }
      }
    );
    console.log(response, "Conversation updated successfully");
  } catch (err) {
    console.log("Error updating conversation:", err);
  }
};

updateConversation();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def updateConversation():
    conversation = assistant.PublicConversation.update(
        conversation_id="abc123-def456-ghi789",
        config_guid="22222222-2222-2222-2222-222222222222",
        title="Updated Conversation Title",
        message="Updated initial message",
        metadata={
            "source": "mobile",
            "user_id": "user-456"
        }
    )
    print("Updated Conversation:")
    print(conversation)

updateConversation()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

ConversationRequest request = new ConversationRequest
{
    config_guid = "22222222-2222-2222-2222-222222222222",
    title = "Updated Conversation Title",
    message = "Updated initial message",
    metadata = new Dictionary<string, object>
    {
        { "source", "mobile" },
        { "user_id", "user-456" }
    }
};

Conversation updatedConversation = await sdk.PublicConversation.Update(
    "abc123-def456-ghi789",
    request
);

Response

Returns the updated conversation object:

{
  "conversation_id": "abc123-def456-ghi789",
  "tenant_guid": "00000000-0000-0000-0000-000000000000",
  "user_guid": "11111111-1111-1111-1111-111111111111",
  "session_id": "session-abc-123",
  "config_guid": "22222222-2222-2222-2222-222222222222",
  "title": "Updated Conversation Title",
  "message_count": 15,
  "last_message_at": "2025-01-15T10:30:00.000000Z",
  "created_at": "2025-01-15T09:00:00.000000Z",
  "updated_at": "2025-01-15T11:00:00.000000Z",
  "metadata": {
    "source": "mobile",
    "user_id": "user-456"
  }
}

Read Messages

Retrieves messages from a conversation using GET /v1.0/tenants/[tenant-guid]/assistant/public/conversations/[conversation-id]/messages. Returns paginated messages with optional superseded message filtering.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation to retrieve messages from
  • limit (number, Query, Optional): Number of messages to retrieve (default: 100)
  • offset (number, Query, Optional): Offset for message pagination (default: 0)
  • include_superseded (boolean, Query, Optional): Whether to include superseded messages (default: false)
curl --location 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/public/conversations/abc123-def456-ghi789/messages?limit=100&offset=0&include_superseded=false' \
--header 'Authorization: ••••••'
import { ViewSdk } from "view-sdk";

const api = new ViewSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const readMessages = async () => {
  try {
    const response = await api.PublicConversation.readMessages(
      "abc123-def456-ghi789",
      100, // messagesLimit
      0,   // messagesOffset
      false // includeSuperseded
    );
    console.log(response, "Messages fetched successfully");
  } catch (err) {
    console.log("Error fetching messages:", err);
  }
};

readMessages();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def readMessages():
    messages = assistant.PublicConversation.read_messages(
        conversation_id="abc123-def456-ghi789",
        messages_limit=100,
        messages_offset=0,
        include_superseded=False
    )
    print("Messages:")
    print(messages)

readMessages()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

ReadMessagesResponse[] response = await sdk.PublicConversation.ReadMessages(
    "abc123-def456-ghi789",
    messagesLimit: 100,
    messagesOffset: 0,
    includeSuperseded: false
);

Response

Returns paginated messages from the conversation:

{
  "messages": [
    {
      "message_id": "msg-001",
      "conversation_id": "abc123-def456-ghi789",
      "role": "user",
      "content": "Hello, I need help with my project.",
      "sources": null,
      "metadata": null,
      "created_at": "2025-01-15T09:00:00.000000Z",
      "is_superseded": false,
      "superseded_at": null,
      "superseded_by_message_id": null,
      "edited_at": null,
      "original_content": null
    },
    {
      "message_id": "msg-002",
      "conversation_id": "abc123-def456-ghi789",
      "role": "assistant",
      "content": "I'd be happy to help you with your project. What specific aspects would you like to discuss?",
      "sources": null,
      "metadata": null,
      "created_at": "2025-01-15T09:00:15.000000Z",
      "is_superseded": false,
      "superseded_at": null,
      "superseded_by_message_id": null,
      "edited_at": null,
      "original_content": null
    }
  ],
  "total": 15,
  "limit": 100,
  "offset": 0
}

Add Messages

Adds a new message to a conversation using POST /v1.0/tenants/[tenant-guid]/assistant/public/conversations/[conversation-id]/messages. This endpoint supports streaming responses for real-time AI interactions.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation to add the message to
  • message (string, Required): The message content to send
  • documents (any, Optional): Documents to attach to the message

Request Body

{
  "message": "Can you help me understand the requirements?",
  "documents": null
}
curl --location --request POST 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/public/conversations/abc123-def456-ghi789/messages' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "message": "Can you help me understand the requirements?",
    "documents": null
}'
import { ViewSdk } from "view-sdk";

const api = new ViewSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const addMessage = async () => {
  try {
    const response = await api.PublicConversation.addMessages(
      "abc123-def456-ghi789",
      {
        message: "Can you help me understand the requirements?",
        documents: null
      },
      (token) => {
        // Handle streaming tokens
        console.log("Token:", token);
      }
    );
    console.log(response, "Message added successfully");
  } catch (err) {
    console.log("Error adding message:", err);
  }
};

addMessage();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def addMessage():
    def on_token(token):
        # Handle streaming tokens
        print("Token:", token)
    
    message = assistant.PublicConversation.add_messages(
        conversation_id="abc123-def456-ghi789",
        message="Can you help me understand the requirements?",
        documents=None,
        on_token=on_token
    )
    print("Added Message:")
    print(message)

addMessage()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

AddMessagesRequest request = new AddMessagesRequest
{
    message = "Can you help me understand the requirements?",
    documents = null
};

ConversationMessage message = await sdk.PublicConversation.AddMessages(
    "abc123-def456-ghi789",
    request,
    (token) => {
        // Handle streaming tokens
        Console.WriteLine("Token: {0}", token);
    }
);

Response

Returns the added message with streaming support:

{
  "message_id": "msg-003",
  "conversation_id": "abc123-def456-ghi789",
  "role": "user",
  "content": "Can you help me understand the requirements?",
  "sources": null,
  "metadata": null,
  "created_at": "2025-01-15T10:45:00.000000Z",
  "is_superseded": false,
  "superseded_at": null,
  "superseded_by_message_id": null,
  "edited_at": null,
  "original_content": null
}

Note: This endpoint supports streaming responses. Tokens are delivered incrementally via the onToken callback function.

Update Messages

Updates an existing message in a conversation using PATCH /v1.0/tenants/[tenant-guid]/assistant/public/conversations/[conversation-id]/messages/[message-id]. This endpoint supports streaming responses for updated AI interactions.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation containing the message
  • message-id (string, Path, Required): ID of the message to update
  • message (string, Required): Updated message content
  • documents (any, Optional): Updated documents to attach

Request Body

{
  "message": "Updated message content",
  "documents": null
}
curl --location --request PATCH 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/public/conversations/abc123-def456-ghi789/messages/msg-003' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "message": "Updated message content",
    "documents": null
}'
import { ViewSdk } from "view-sdk";

const api = new ViewSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const updateMessage = async () => {
  try {
    const response = await api.PublicConversation.updateMessages(
      "abc123-def456-ghi789",
      "msg-003",
      {
        message: "Updated message content",
        documents: null
      },
      (token) => {
        // Handle streaming tokens
        console.log("Token:", token);
      }
    );
    console.log(response, "Message updated successfully");
  } catch (err) {
    console.log("Error updating message:", err);
  }
};

updateMessage();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def updateMessage():
    def on_token(token):
        # Handle streaming tokens
        print("Token:", token)
    
    message = assistant.PublicConversation.update_messages(
        conversation_id="abc123-def456-ghi789",
        message_id="msg-003",
        message="Updated message content",
        documents=None,
        on_token=on_token
    )
    print("Updated Message:")
    print(message)

updateMessage()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

AddMessagesRequest request = new AddMessagesRequest
{
    message = "Updated message content",
    documents = null
};

ConversationMessage message = await sdk.PublicConversation.UpdateMessages(
    "abc123-def456-ghi789",
    "msg-003",
    request,
    (token) => {
        // Handle streaming tokens
        Console.WriteLine("Token: {0}", token);
    }
);

Response

Returns the updated message with streaming support:

{
  "message_id": "msg-003",
  "conversation_id": "abc123-def456-ghi789",
  "role": "user",
  "content": "Updated message content",
  "sources": null,
  "metadata": null,
  "created_at": "2025-01-15T10:45:00.000000Z",
  "is_superseded": false,
  "superseded_at": null,
  "superseded_by_message_id": null,
  "edited_at": "2025-01-15T10:50:00.000000Z",
  "original_content": "Can you help me understand the requirements?"
}

Note: This endpoint supports streaming responses. Tokens are delivered incrementally via the onToken callback function.

Best Practices

When managing public conversations and messages in the View Assistant platform, consider the following recommendations for optimal AI interaction and conversation management:

  • Conversation Organization: Use descriptive titles to clearly identify the purpose and context of each conversation
  • Pagination: Utilize limit and offset parameters effectively to manage large conversation and message lists
  • Streaming: Implement proper token handling for real-time user experiences when using streaming endpoints
  • Metadata Management: Use metadata fields flexibly to track conversation sources, user context, and application-specific information
  • Message Lifecycle: Understand superseded messages and use include_superseded parameter appropriately when needed
  • Error Handling: Implement robust error handling for network issues, authentication failures, and API rate limits
  • Performance: Monitor conversation message counts and consider archiving or cleanup strategies for long-running conversations
  • Document Attachments: Properly manage document attachments to optimize conversation context and AI responses
  • Public API Considerations: Remember that public conversations do not support deletion operations, so plan conversation lifecycle accordingly

Next Steps

After successfully managing public conversations and messages, you can:

  • AI Integration: Leverage public conversations for integrated AI assistant features in public-facing applications
  • Conversation Analytics: Analyze conversation patterns and message interactions for insights
  • User Experience: Build real-time chat interfaces using streaming message responses
  • Document Management: Integrate document attachments for enhanced AI context and responses
  • Multi-Conversation Management: Organize and manage multiple concurrent conversations per user
  • Platform Integration: Integrate public conversations with other View platform services for comprehensive AI workflows