Learn how to create and manage dialogs.
type
to 3
and ID of an opponent you want to create a chat with.
type
to 2
and IDs of opponents, you want to create a chat with.
type
to 1
and a name for a new dialog.
params
.
Field | Required | Description |
---|---|---|
type | yes | Dialog type. There tree dialog types:- type: 1 - public dialog.- type: 2 - group dialog.- type: 3 - private dialog. |
name | yes | Dialog name. |
data | yes | Specifies additional parameters in a new dialog. |
join()
method. If you’ve successfully joined the dialog, you can send/receive messages in real-time. See this section to learn how to send/receive messages.
Argument | Required | Description |
---|---|---|
dialogJid | yes | Room JID. JID (Jabber ID) of XMPP room in the XMPP server. Empty for a privatе dialog. Generated automatically by the server after dialog creation. You can get JID from the dialog ID. The JID format is the following: <app_id>-<dialog_id>@muc.chat.quickblox.com |
function() | yes | Specifies a callback function that accepts an error and result. |
join()
method is used with regard to the dialog type.
Capabilities | Public | Group | Private |
---|---|---|---|
Join | ✓ | ✓ | ✗ |
occupants_ids
array, in the dialog model.Your user ID is added to the occupants_ids
array if you create a dialog or you are added to the dialog by the other user. See this section to learn how to add occupants to the group dialog.leave()
method. If the dialog is left, you can’t send/receive messages. To be able to receive/send messages, you need to join it.
Argument | Required | Description |
---|---|---|
dialogJid | yes | Room JID. JID (Jabber ID) of XMPP room in the XMPP server. Empty for a privatе dialog. Generated automatically by the server after dialog creation. You can get JID from the dialog ID. The JID format is the following: <app_id>-<dialog_id>@muc.chat.quickblox.com |
function() | yes | Specifies a callback function that accepts an error. |
leave()
method is used with regard to the dialog type.
Capabilities | Public | Group | Private |
---|---|---|---|
Leave | ✓ | ✓ | ✗ |
occupants_ids
array, in the dialog model. As a result, the dialog will still be present in the list of dialogs and you will still have access to the chat history.To remove yourself from the group dialog, use the update()
method. See this section to learn how to remove occupants from the group dialog.listOnlineUsers()
method to get the list of online users who are joined to the dialog. As a result, an array of user IDs is returned.
listOnlineUsers()
method is used with regard to the dialog type.
Capabilities | Public | Group | Private |
---|---|---|---|
Retrieve online users | ✗ | ✓ | ✗ |
created_at
field, and limited to 10 dialogs on the page.
Argument | Required | Description |
---|---|---|
params | no | Specifies param fields that should be set. |
function() | yes | A callback function that an accepts error and dialogs. |
filter
:
Field | Required | Description |
---|---|---|
skip | no | Skip N records in search results. Useful for pagination. Default (if not specified): 0. Should be an Integer. |
limit | no | Limit search results to N records. Useful for pagination. Default value: 100. |
Search operators | Applicable to types | Applicable to fields | Description |
---|---|---|---|
lt | number, string, date | last_message_date_sent, created_at, updated_at | Less Than operator. |
lte | number, string, date | last_message_date_sent, created_at, updated_at | Less Than or Equal to operator. |
gt | number, string, date | last_message_date_sent, created_at, updated_at | Greater Than operator. |
gte | number, string, date | last_message_date_sent, created_at, updated_at | Greater Than or Equal to operator. |
ne | number, string, date | _id, name, last_message_date_sent | Not Equal to operator. |
in | number, string, date | type, last_message_date_sent, name | IN array operator. |
nin | number, string, date | last_message_date_sent | IN array operator. |
all | number | occupants_ids | ALL are contained in array. |
ctn | string | name | All records that contain a particular substring. |
Sort operator | Applicable to types | Applicable to fields | Description |
---|---|---|---|
sort_asc | All types | id, created_at, name, last_message_date_sent | Search results will be sorted in ascending order by the specified field. |
sort_desc | All types | id, created_at, name, last_message_date_sent | Search results will be sorted in descending order by the specified field. |
Aggregation operator | Description |
---|---|
count | Count search results. The response will contain only a count of records found. Set count to 1 to apply. |
category
and class_name
.
Capabilities | Public dialog | Group dialog | Private dialog |
---|---|---|---|
Update a dialog name | Owner | Owner | ✗ |
Update a photo | Owner | Owner | ✗ |
Update custom parameters | Owner,Occupant | Owner,Occupant | Owner,Occupant |
push_all
field to add occupants to the dialog. As a result, the ID of the opponent will be added to the occupants_ids
array.
Arguments | Required | Description |
---|---|---|
dialogId | yes | Dialog ID. |
toUpdateParams | yes | Specifies the toUpdateParams fields that should be set. |
Capabilities | Public dialog | Group dialog | Private dialog |
---|---|---|---|
Add other users | ✗ | Owner,Occupant | ✗ |
pull_all
field to remove occupants from the dialog. As a result, the ID of the opponent will be removed from the occupants_ids
array.
Argument | Required | Description |
---|---|---|
dialogId | yes | Dialog ID. |
toUpdateParams | yes | Specifies the toUpdateParams fields that should be set. |
Capabilities | Public dialog | Group dialog | Private dialog |
---|---|---|---|
Remove other users | ✗ | Owner | ✗ |
Remove yourself | ✗ | Owner,Occupant | ✗ |
force
to 1
to completely remove the dialog for all users. You can also delete multiple dialogs in a single request.
Capabilities | Public | Group | Private |
---|---|---|---|
Delete dialog for all userusing forceparameter. | Owner | Owner | Owner |
Delete dialog for a current user | Owner | Owner,Occupant | Owner,Occupant |
list()
method.
unreadCount()
method.
params
:
Field | Description |
---|---|
chat_dialog_ids | IDs of dialogs.- If chat_dialog_ids are not specified, the total number of unread messages for all dialogs of the user will be returned.- If chat_dialog_ids are specified, the number of unread messages for each specified dialog will be returned. Also, the total number of unread messages for all dialogs of the user will be returned. |