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
| Parameter | Description | Data Type |
|---|---|---|
| auth | Go to Dashboard -> Developer -> Private Key is your auth | String |
Path Parameters
| Parameter | Description | Data Type |
|---|---|---|
| uniqueUserIdentifier | Unique Identifier for the user | String |
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:
| Field | Description | Data Type |
|---|---|---|
| chatRoom | The chat room, as an object with roomId and name | Object |
| roleName | The user's role in that chat room | String |
| lastSeen | When the user was last seen in that chat room | Date |
| created | When the membership was created | Date |
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 RequestBody:
{"message": "user not found"} -
Invalid API Key:
HTTP Status:
401 UnauthorizedBody:
{"message": "Invalid auth token"} -
No API Key Specified:
HTTP Status:
401 UnauthorizedBody:
{"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>")