Skip to main content

Make or Update Chat Room Member

Use this endpoint to either add a new member to a chat room or update role of an existing member's role within a chat room. This allows for flexible member management within specific chat rooms.


POST
    https://api.deadsimplechat.com/consumer/api/v2/room/:roomId/member

Request

POST /consumer/api/v2/room/:roomId/member

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
roomIdThe unique identifier for the chat roomString

Body Parameters

ParameterDescriptionData Type
uniqueUserIdentifierUnique Identifier for the userString
roleNameThe role of the user in the chat room ("user", "guest", "admin", "moderator")String

Responses

Success Response

A JSON object containing the updated or newly created chat room member's data along with associated chat room and user details.

HTTP Status: 200 OK

Body:

{
"user": { "username": "sample username", "profilePic": "sample profile picture URL", ... },
"chatRoom": { "name": "sample room", "roomId": "sampleId" },
"roleName": "sample role",
...
}

Error Responses

  • Invalid request body:

    HTTP Status: 400 Bad Request

    Body:

    {
    "error": { ...validation details... }
    }
  • Invalid API Key:

    HTTP Status: 401 Unauthorized

    Body:

    {
    "error": "Invalid API Key"
    }
  • User not found:

    HTTP Status: 400 Bad Request

    Body:

    {
    "message": "user not found"
    }
  • Specified chat room not found:

    HTTP Status: 400 Bad Request

    Body:

    {
    "message": "chatRoom not found"
    }

Code Examples

JavaScript (Fetch API)

fetch("https://api.deadsimplechat.com/consumer/api/v2/room/<ROOM_ID>/member?auth=<YOUR_SECRET_KEY>", {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
uniqueUserIdentifier: '<USER_IDENTIFIER>',
roleName: 'user'
})
})