Skip to main content

Complete message

Description

Create a message and get a response from a chat.

Endpoint

POST https://api.cogfy.com/collections/:collectionId/chats/:chatId/messages

Path Parameters

  • collectionId: The ID of the collection that contains the chat. Must be a valid UUID.
  • chatId: The ID of the chat where the message will be sent. Must be a valid UUID.

Request Body

  • content: The content of the message.
  • contentType: The type of content. Can be "text" or "audio".
  • file: Contains file information if a file is included in the message.
    • name: The name of the file.
    • size: The file size in bytes.
    • mimeType: The MIME type of the file.
    • base64: The base64-encoded file content.

Example JSON Request

{
"content": "Hello!",
"contentType": "text",
"file": {
"name": "example.pdf",
"size": 234131,
"mimeType": "application/pdf",
"base64": "JVBERi0xLjQKJ..."
}
}

Response Body

  • id: The unique identifier of the created message.
  • content: The content of the message.
  • files: A list of files attached to the message, each containing:
    • name: The name of the file.
    • size: The file size in bytes.
    • mimeType: The MIME type of the file.
    • base64: The base64-encoded file content.

Example JSON Response

{
"id": "550e8400-e29b-41d4-a716-446655440000",
"content": "Hello, how can I help you?",
"files": [
{
"name": "audio.mp3",
"size": 343721,
"mimeType": "audio.mp3",
"base64": "WVREFiLG0aADKGK..."
}
]
}