Chat Threads, Messages and Participants
Chat threads represent conversations between users, while messages are individual communications within those threads.
Endpoints
Method |
Endpoint |
Description |
GET |
/chat/threads |
List chat threads |
POST |
/chat/threads |
Create a new chat thread |
GET |
/chat/threads/{thread_id} |
Get a specific chat thread |
POST |
/chat/threads/{thread_id}/messages |
Add a message to a chat thread |
PATCH |
/chat/threads/{thread_id}/messages/{message_id} |
Update a message in a chat thread |
GET |
/chat/threads/{thread_id}/participants |
Get participants of a chat thread |
POST |
/chat/threads/{thread_id}/participants |
Add a participant to a chat thread |
Thread Attributes
Attribute |
Type |
Description |
id |
integer |
The ID of the chat thread or message |
client_account_id |
integer |
The client account ID associated with the thread |
provider_client_account_id |
integer |
The provider client account ID associated with the thread |
relation_type |
string |
The type of relation associated with the thread |
relation_id |
integer |
The ID of the relation associated with the thread |
created_by_id |
integer |
The ID of the user who created the thread or message |
Message Attributes
Attribute |
Type |
Description |
id |
integer |
The ID of the message |
thread_id |
integer |
The ID of the chat thread associated with the message |
message |
string |
The content of the message |
created_at |
string |
The date and time when the message was created |
created_by_id |
integer |
The ID of the user who created the message |
Participant Attributes
Attribute |
Type |
Description |
id |
integer |
The ID of the participant |
thread_id |
integer |
The ID of the chat thread associated with the participant |
user_id |
integer |
The ID of the user associated with the participant |
Query Parameters
Parameter |
Type |
Description |
client_account_id |
integer |
Filter threads by client account ID |
provider_client_account_id |
integer |
Filter threads by provider client account ID |
relation_type |
string |
Filter threads by relation type |
relation_id |
integer |
Filter threads by relation ID |
order_by |
string |
Specify the order of returned threads |
page |
integer |
The page number for paginated results (default: 1) |
per_page |
integer |
The number of items per page (default: 100) |
Relationships
Relationship |
Type |
Description |
messages |
[Message] |
The messages in a chat thread |
participants |
[Participant] |
The participants in a chat thread |
Notes
- All endpoints require authentication.
- Access to threads and messages is restricted based on the user’s eligible client accounts.
- The
serialize
decorator is used with different serializers (ThreadSerializer, MessageSerializer, ParticipantSerializer) to format the response data.
- Error responses:
- 403 Forbidden: When trying to access a thread not associated with the user’s eligible client accounts.
- 404 Not Found: When a specified thread or message doesn’t exist.