Skip to content

Generate a Message

POST https://app.sociable.how/api/createChatCompletion

To use this endpoint, you must have already created a dialogue and have its id property. If you have forgotten your dialogue’s id property, you can use the previous endpoint to view all dialogues and find it again.

Through this endpoint you’ll be able to send one or more messages and generate a response based on the customizations you specified in the dashboard.

There is no need to keep track of previous messages as we store messages for you in our database. We use previous messages to continuously provide conversational context for your AI persona.

Request Parameters

ParameterDescriptionExample
dialogueIdCurrent dialogue’s id property9c831f86-3859-49b6-8b58-4b5425aaf131
messagesAn array of Message objects. If passing in multiple messages, order with the oldest message at the beginning and newest message at the end of the array.

See below for more information.
[{
“role”: “USER”,
“content”: “hi”,
“type”: “TEXT”
}]
metadata (optional)An object with two properties.
1. context (optional): String. Specify context for the conversation.
2. event (optional): Enumerated value. Can either be “MESSAGE” or “COMMENT”.
{
“context”: “You are discussing travel sites along the Pacific coast”,
“event”: “MESSAGE”
}

A Message object consists of the following:

role: Enumerated value. Can either be USER or PERSONA. Indicates who the message is coming from.

content: String. Content of the message.

type: Enumerated value. Can either be TEXT, IMAGE, NO_RESPONSE. Indicates message type (default TEXT).

Sample Request:

{
"messages": [
{"role": "USER", "content": "hey, remember me?", "type": "TEXT"},
{"role": "PERSONA", "content": "yeah, fs", "type": "TEXT"},
{"role": "USER", "content": "like high school right?", "type": "TEXT"}
],
"metadata":{
"context": "Speaking to your friend from high school.",
"event": "MESSAGE"
},
"dialogueId": "8eb9093d-45a8-40b0-9cbe-80b81622b1dd"
}

Sample Response:

{
"success": true,
"response": {
"id": "fcabc46a-9b65-4774-9563-4dafde6e12b5",
"content": "Of course! How could I forget? What’s up?",
"type": "TEXT",
"role": "PERSONA",
"date": "2024-07-31T21:31:44.010Z",
"dialogueId": "8eb9093d-45a8-40b0-9cbe-80b81622b1dd",
"metadata": {},
"automated": false
}
}