Skip to main content

Get Member's Chat Rooms

Retrieve a list of chat rooms to which a specific user belongs.


GET
https://api.deadsimplechat.com/consumer/api/v2/user/:uniqueUserIdentifier/rooms

Request

GET /consumer/api/v2/user/:uniqueUserIdentifier/rooms

info

The auth query parameter is your private key. You can find it in your Dashboard under Developer -> Private Key.

Query Parameters

ParameterDescriptionData Type
authGo to Dashboard -> Developer -> Private Key is your authString

Path Parameters

ParameterDescriptionData Type
uniqueUserIdentifierUnique Identifier for the userString

Responses

Success Response

A JSON array containing the chat rooms the user is a member of. Each object in the array will have the following fields:

FieldDescriptionData Type
chatRoomThe chat room, as an object with roomId and nameObject
roleNameThe user's role in that chat roomString
lastSeenWhen the user was last seen in that chat roomDate
createdWhen the membership was createdDate

The room's id is nested inside chatRoom, so read response[0].chatRoom.roomId, not response[0].roomId.

HTTP Status: 200 OK

Body Example:

[
{
"_id": "65b1f0a2c9e77a0012a4c1d3",
"chatRoom": {
"_id": "64f2a1b8d3e5c60011ab9f21",
"roomId": "12345",
"name": "General Chat"
},
"roleName": "member",
"lastSeen": "2024-01-24T10:12:44.881Z",
"created": "2024-01-20T08:03:11.204Z"
}
]

Error Responses

  • User not found:

    HTTP Status: 400 Bad Request

    Body:

    {
    "message": "user not found"
    }
  • Invalid API Key:

    HTTP Status: 401 Unauthorized

    Body:

    {
    "message": "Invalid auth token"
    }
  • No API Key Specified:

    HTTP Status: 401 Unauthorized

    Body:

    {
    "message": "Unauthorized, please pass the auth token"
    }

Code Examples

JavaScript (Fetch API)

fetch("https://api.deadsimplechat.com/consumer/api/v2/user/<USER_IDENTIFIER>/rooms?auth=<YOUR_SECRET_KEY>")