# Messages
The Messages API provides an interface for managing messages within a specific conversation. Each message is tied to a Conversation via conversation_id, ensuring that messages are contextually related to a single conversation.
# Get Message List
Retrieve a list of all messages within a specified conversation.
- URL:
patients/conversations/<str:conversation_id>/messages/ - Method:
GET - Request Parameter:
conversation_id(required) - Theunique_idof the conversation to retrieve messages from.
- Response Example:
[ { "unique_id": "msg123", "conversation_id": "con123", "message_type": "user", "content": "Hello, I need help.", "date_created": "2023-01-01T12:00:00Z", "last_updated": "2023-01-01T12:00:00Z" }, { "unique_id": "msg456", "conversation_id": "con123", "message_type": "assistant", "content": "How can I assist you today?", "date_created": "2023-01-01T12:01:00Z", "last_updated": "2023-01-01T12:01:00Z" } ]
# Create a Message
Create a new message within a specific conversation.
URL:
patients/conversations/<str:conversation_id>/messages/Method:
POSTRequest Example:
{ "message_type": "user", "content": "This is a new message in the conversation." }Note: The
conversation_idprovided in the URL is used to associate the message with the correct conversation.Response Example:
{ "unique_id": "msg789", "conversation_id": "con123", "message_type": "user", "content": "This is a new message in the conversation.", "date_created": "2023-01-01T12:05:00Z", "last_updated": "2023-01-01T12:05:00Z" }
# Get a Message
Retrieve details of a specific message by its unique ID.
- URL:
patients/messages/<str:unique_id>/ - Method:
GET - Response Example:
{ "unique_id": "msg123", "conversation_id": "con123", "message_type": "user", "content": "Hello, I need help.", "date_created": "2023-01-01T12:00:00Z", "last_updated": "2023-01-01T12:00:00Z" }
# Update a Message
Update the details of a specific message by its unique ID.
- URL:
patients/messages/<str:unique_id>/ - Method:
PUT - Request Example:
{ "content": "Updated message content." } - Response Example:
{ "unique_id": "msg123", "conversation_id": "con123", "message_type": "user", "content": "Updated message content.", "date_created": "2023-01-01T12:00:00Z", "last_updated": "2023-01-01T12:10:00Z" }
# Delete a Message
Delete a specific message by its unique ID.
- URL:
patients/messages/<str:unique_id>/ - Method:
DELETE - Response:
204 No Content