Create chat
Creates a new chat.
Endpoint
POST https://api.cogfy.com/collections/:collectionId/chats
Path parameters
collectionId
: The ID of the collection that the chat will be created in.
Request body
fieldId
: The ID of the chat field.recordId
: The ID of the chat record that the chat will be created in.properties
: An object with the field ID as the key and the value as the field value to populate other fields of the record. See create-record docs.messages
: Contains an array of messages to be set as history for the chat.
Example JSON request
{
"fieldId": "eb070e5e-8dce-42a4-89d1-200bab77a97d",
"recordId": "1cd13c46-c053-4bc6-94ee-28327fff5886",
"messages": [
{
"role": "assistant",
"content": "How can I help you?"
},
{
"role": "user",
"content": "I want to learn more about Cogfy!"
}
]
}
Response body
id
: The unique identifier of the created chat.collectionId
: The ID of the collection the chat was created in.fieldId
: The ID of the chat field.recordId
: The ID of the record.messages
: An array of the chat messages.
Example JSON response
{
"id": "a42666d9-98b1-43d4-a997-4e0543a3d824",
"collectionId": "831d276b-11fd-49b7-8eee-dafe88407697",
"fieldId": "eb070e5e-8dce-42a4-89d1-200bab77a97d",
"recordId": "1cd13c46-c053-4bc6-94ee-28327fff5886",
"messages": [
{
"role": "assistant",
"content": "How can I help you?"
},
{
"role": "user",
"content": "I want to learn more about Cogfy!"
}
]
}