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:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[POST] /create_room

Params:

KeyTypeDescription
room_name (required)stringName of group chat room
participants[] (required)string[]Array of userIds
creator (required)stringUser id for group chat room creator
room_avatar_url (optional)stringAvatar of group chat room
room_options(optional)json to stringYou can define meta data

Example request:

Bash
Copy

Response:

JSON
Copy

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:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[POST] /get_or_create_room_with_target

Params:

KeyTypeDescription
user_ids[] (required)string[]array of user id, the array must contains 2 user id
room_options (optional)json to stringyou can define your own metadata

Example request:

Bash
Copy

Response:

JSON
Copy

Get or Create Channel

You can create Channel or you can get channel if you already have in Qiscus Server.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[POST] /get_or_create_channel

Params:

KeyTypeDescription
unique_id (required)stringYou need to define unique id for channel, cannot contains symbol # and +
participants[] (required)string[]Min: 1, array of user id for channel
room_name (optional)stringChannel name
room_avatar_url (optional)stringChannel avatar url
room_options (optional)json to stringYou can define your own metadata

Example request:

Bash
Copy

Response:

JSON
Copy

Get Chat Room Information

To get chat room information(data) by roomIds.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[GET] /get_rooms_info

Params:

KeyTypeDescription
room_ids[] (required)int[]Max: 100, array of room id, it can optional if you set the room_channel_ids
room_channel ids[] (required)string[]Max: 100, array of room unique id, it can optional if you set the room_ids

Example request:

Bash
Copy

Response:

JSON
Copy

Update Chat Room

To update Chat Room's data.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[POST] /update_room

Params:

KeyTypeDescription
room_id (required)stringid of Chat Room
room_channel_id (required)stringunique id of Chat Room, required if the chat room type is channel
room_name (optional)stringChat Room name
room_avatar_url (optional)stringChat Room avatar url
room_options (optional)json to stringYou can define your own metadata

Example request:

Bash
Copy

Response:

JSON
Copy

Get Chat Room List

To get list of chat rooms that userId has. These chat rooms are sorted by the latest message, means, whenever there's the latest message in a chat room, the order of chat room list will change based on the latest to oldest one.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[GET] /get_user_rooms

Params:

KeyTypeDescription
user_id (required)stringuserId
page (optional)intnumber of page, default: 1
limit (optional)intdefault: 20, max: 100, if the limit more than 100 then return 20
show_empty (optional)booleanshould include room with no message in the response or not
room_type (optional)single | group | channel (string)filter room list based on type of room

Example request:

Bash
Copy

Response:

JSON
Copy

Get Unread Count in Chat Rooms

To get unread count in each Chat Rooms that userId has.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[GET] /get_unread_count

Params:

KeyTypeDescription
user_id (required)stringUser Id
room_ids[] (required)intArray of room ids
room_channel_ids[] (optional)stringArray of room channel ids

Example request:

Bash
Copy

Response:

JSON
Copy

Get Participant List in Chat Room

To retrieve all participant in a Chat Room.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[GET] /get_room_participants

Params:

KeyTypeDescription
room_id (required)intChat Room Id
page (optional)intDefault: 1
limit (optional)intShow n data

Example request:

Bash
Copy

Response:

JSON
Copy

Add Participant in Chat Room

To add participant in a Chat Room.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[POST] /add_room_participants

Params:

KeyTypeDescription
room_id (required)stringChat Room Id
user_ids[] (required)stringArray of string user_ids

Example request:

Bash
Copy

Response:

JSON
Copy

Remove Participant in Chat Room

To remove a participant in Chat Room.

Request:

HTTP
Copy

Headers:

Bash
Copy

Endpoint:

[POST] /remove_room_participants

Params:

KeyTypeDescription
room_id (required)stringChat Room Id
user_ids[] (required)stringArray of userIds

Example request:

Bash
Copy

Response:

JSON
Copy
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard