Complete message
Creates a message and gets 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.chatId: The ID of the chat where the message will be sent.
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..."
}
]
}