Chat
Get Get Active Chats
This endpoint allows a user to get a list of all of their active chats. The endpoint requires an access token that represents the user who wants to get a list of their active chats. The server then returns a list of all chats that the user is a part of.
Field | Type | Description |
---|---|---|
skip Default value: 0 | number | The number of messages to skip. |
limit Default value: 15 | number | The number of messages to return. |
Post Send Chat Request
This endpoint allows a user to send a chat request to another user. The endpoint requires an access token that represents the user who wants to send a chat request. The server then creates a new chat between the two users and returns the chat object.
Field | Type | Description |
---|---|---|
userId | number | The unique id of the user to send the chat request to. |
Get Get Pending Chat Requests
This endpoint allows a user to get a list of all of their pending chat requests. The endpoint requires an access token that represents the user who wants to get a list of their pending chat requests. The server then returns a list of all pending chat requests that the user has sent.
Field | Type | Description |
---|---|---|
skip Default value: 0 | number | The number of messages to skip. |
limit Default value: 15 | number | The number of messages to return. |
Get Get Rejected Chat Requests
This endpoint allows a user to get a list of all of their rejected chat requests. The endpoint requires an access token that represents the user who wants to get a list of their rejected chat requests. The server then returns a list of all rejected chat requests that the user has sent.
Field | Type | Description |
---|---|---|
skip Default value: 0 | number | The number of messages to skip. |
limit Default value: 15 | number | The number of messages to return. |
Accept Chat Request
This endpoint allows a user to accept a chat request from another user. The endpoint requires an access token that represents the user who wants to accept a chat request. The server then updates the status of the chat to "active" and returns the chat object.
Field | Type | Description |
---|---|---|
chatId | string | The unique id of the chat. |
Decline Chat Request
This endpoint allows a user to decline a chat request from another user. The endpoint requires an access token that represents the user who wants to decline a chat request. The server then updates the status of the chat to "declined" and returns the chat object.
Field | Type | Description |
---|---|---|
chatId | string | The unique id of the chat. |
Get Get Chat Messages
This endpoint allows a user to get a list of all of their chat messages. The endpoint requires an access token that represents the user who wants to get a list of their chat messages. The server then returns a list of all chat messages that the user has sent or received.
Field | Type | Description |
---|---|---|
chatId | string | The unique id of the chat. |
Field | Type | Description |
---|---|---|
skip Default value: 0 | number | The number of messages to skip. |
limit Default value: 15 | number | The number of messages to return. |
Mark Chat Messages as Read
This endpoint allows a user to mark all of their unread chat messages as read. The endpoint requires an access token that represents the user who wants to mark all messages as read. The server then updates the status of all messages in the user's chat history to "read".
After a successful operation, the server returns a JSON response with a status message and a description of the result of the operation. If there was an error, the server returns an appropriate HTTP status code and an error message in the response body.
Field | Type | Description |
---|---|---|
chatId | string | The unique id of the chat. |
Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": true,
"message": "All messages have been marked as read.",
}
Get Get Totals
This endpoint allows a user to get the total number of pending chat requests and total number of unread messages.
HTTP/1.1 200 OK
Content-Type: application/json
{
"totalPendingRequest": 0,
"totalUnreadMessages": 0,
}
Get Get Total Unread Messages
This endpoint allows a user to get the total number of unread messages in all of their chats. The endpoint requires an access token that represents the user who wants to get the total number of unread messages. The server then returns the total number of unread messages.
Post Send Chat Message
This endpoint allows a user to send a message to another user. The endpoint requires an access token that represents the user who wants to send a message. The server then creates a new message and returns the message object.
Field | Type | Description |
---|---|---|
chatId | string | The unique id of the chat. |
Field | Type | Description |
---|---|---|
text | string | The message to send. |
imageUrl | string | The url of the image to send. |
linkPreviewUrl | string | The url of the link to send. |