Chat Room
In Chat Room you can add additional information called options that is automatically synchronized by each participant in the conversation. It is important that the amount of data stored in options is kept to a minimum to ensure the quickest synchronization possible. For further detail you can see this Chat Room Types section.
Create Group Chat Room
When you create Group Chat Room, the creator not automatically joined in the chat room that created by the creator itself, so you should add to participant key in the parameter for adding the creator.
Request:
Headers:
Endpoint:
[POST] /create_room
Params:
Key | Type | Description |
|---|---|---|
room_name (required) | string | Name of group chat room |
participants[] (required) | string[] | Array of userIds |
creator (required) | string | User id for group chat room creator |
room_avatar_url (optional) | string | Avatar of group chat room |
room_options(optional) | json to string | You can define meta data |
Example request:
Response:
Get or Create 1-on-1 Chat Room
The ideal creating 1-on-1 Chat Room is for use case that requires 2 users, for further information you can see this Chat Room types. After successfully creating a 1-on-1 Chat Room, the display name will be another userId.
Request:
Headers:
Endpoint:
[POST] /get_or_create_room_with_target
Params:
Key | Type | Description |
|---|---|---|
user_ids[] (required) | string[] | array of user id, the array must contains 2 user id |
room_options (optional) | json to string | you can define your own metadata |
Example request:
Response:
Get or Create Channel
You can create Channel or you can get channel if you already have in Qiscus Server.
Request:
Headers:
Endpoint:
[POST] /get_or_create_channel
Params:
Key | Type | Description |
|---|---|---|
unique_id (required) | string | You need to define unique id for channel |
participants[] (required) | string[] | Min: 1, array of user id for channel |
room_name (optional) | string | Channel name |
room_avatar_url (optional) | string | Channel avatar url |
room_options (optional) | json to string | You can define your own metadata |
Example request:
Response:
Get Chat Room Information
To get chat room information(data) by roomIds.
Request:
Headers:
Endpoint:
[GET] /get_rooms_info
Params:
Key | Type | Description |
|---|---|---|
room_ids[] (required) | int[] | Max: 100, array of room id |
room_unique_ids[] (optional) | string[] | Max: 100, array of room unique id |
Example request:
Response:
Update Chat Room
To update Chat Room's data.
Request:
Headers:
Endpoint:
[POST] /update_room
Params:
Key | Type | Description |
|---|---|---|
room_id (required) | string | id of Chat Room |
room_channel_id (required) | string | unique id of Chat Room |
room_name (optional) | string | Chat Room name |
room_avatar_url (optional) | string | Chat Room avatar url |
room_options (optional) | json to string | You can define your own metadata |
Example request:
Response:
Get Chat Room List
To get list of Chat Rooms that userId has.
Request:
Headers:
Endpoint:
[GET] /get_user_rooms
Params:
Key | Type | Description |
|---|---|---|
user_id (required) | string | userId |
page (optional) | int | number of page, default: 1 |
limit (optional) | int | default: 20, max: 100, if the limit more than 100 then return 20 |
Example request:
Response:
Get Participant List in Chat Room
To retrieve all participant in a Chat Room.
Request:
Headers:
Endpoint:
[GET] /get_room_participants
Params:
Key | Type | Description |
|---|---|---|
room_id (required) | int | Chat Room Id |
page (optional) | int | Default: 1 |
limit (optional) | int | Show n data |
Example request:
Response:
Add Participant in Chat Room
To add participant in a Chat Room.
Request:
Headers:
Endpoint:
[POST] /add_room_participants
Params:
Key | Type | Description |
|---|---|---|
room_id (required) | string | Chat Room Id |
user_ids[] (required) | string | Array of string user_ids |
Example request:
Response:
Remove Participant in Chat Room
To remove a participant in Chat Room.
Request:
Headers:
Endpoint:
[POST] /remove_room_participants
Params:
Key | Type | Description |
|---|---|---|
room_id (required) | string | Chat Room Id |
user_ids[] (required) | string | Array of userIds |
Example request:
Response:
Qiscus Technology