Learn how to create and manage dialogs.
createDialog()
method accepts the following arguments:
Argument | Required | Description |
---|---|---|
occupantIds | yes | A list of opponents IDs.- If the occupantsIds array is empty and type is not provided, the public dialog is created.- If the occupantsIds has a single user and type is not provided, the private dialog is created.- If the occupantsIds has more then one userId and type is not provided, a group dialog is created. |
dialogName | yes | The name of the dialog. Required only for group and public dialog types. Not needed for private dialog. |
dialogType | no | A type of the dialog. Possible values: QBChatDialogTypes.CHAT , QBChatDialogTypes.GROUP\_CHAT or QBChatDialogTypes.PUBLIC\_CHAT . By default, the public dialog is created. |
dialogPhoto | no | A url of the image. Can be a link to a file in Content module, Custom Objects module or just a web link.Must be a String. |
joinDialog()
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.
isJoinedDialog()
joinDialog()
method is used with regard to the dialog type.
Capabilities | Public | Group | Private |
---|---|---|---|
Join | ✓ | ✓ | ✗ |
occupantIDs
array, in the dialog model.Your user ID is added to the occupantIDs
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.leaveDialog()
method. If the dialog is left, you can’t send/receive messages. To be able to receive/send messages, you need to join it.
Capabilities | Public | Group | Private |
---|---|---|---|
Leave | ✓ | ✓ | ✗ |
occupantIds
array, in the dialog model. As a result, the dialog is removed from the list of dialogs and you won’t have access to the chat history.To remove a dialog for all users, use the deleteDialog()
method. See this section to learn how to delete the dialog completely for all users.test value
in their names, sorted in ascending order by the QBChatDialogFilterFields.LAST_MESSAGE_DATE_SENT
field, and limited to 100 dialogs on the page with 25 dialogs skipped at the beginning.
Argument | Required | Description |
---|---|---|
sort | no | Specifies sorting criteria for the field. |
filter | no | Specifies filtering criteria for the field. |
limit | no | Limit search results to N records. Useful for pagination. Default value: 100. |
skip | no | Skip N records in search results. Useful for pagination. Default (if not specified): 0. |
flutter_chat
in their names.
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. |
QBChatDialogSorts.LAST_MESSAGE_DATE_SENT
field in descending order.
Sort options | Applicable to types | Applicable to fields | Description |
---|---|---|---|
ascending | All types | id, created_at, name, last_message_date_sent | Sort results in ascending order by setting the ascending as true. |
descending | All types | id, created_at, name, last_message_date_sent | Sort results in descending order by setting the ascending as false. |
Argument | Required | Description |
---|---|---|
dialogId | yes | The ID of the dialog. |
dialogName | no | A name of the dialog. |
dialogPhoto | no | A url of the image. Should be a String. |
Capabilities | Public dialog | Group dialog | Private dialog |
---|---|---|---|
Update a dialog name | Owner | Owner | ✗ |
Update a photo | Owner | Owner | ✗ |
addUsers
argument to add occupants to the dialog. As a result, the ID of the opponent will be added to the occupantIds
array.
Capabilities | Public dialog | Group dialog | Private dialog |
---|---|---|---|
Add other users | ✗ | Owner,Occupant | ✗ |
removeUsers
argument to remove occupants from the dialog. As a result, the ID of the opponent will be removed from the occupantIds
array.
Capabilities | Public dialog | Group dialog | Private dialog |
---|---|---|---|
Remove other users | ✗ | Owner | ✗ |
Remove yourself | ✗ | Owner,Occupant | ✗ |
occupantIds
array in the dialog model. You can also delete multiple dialogs in a single request.
To delete a dialog for yourself, just leave the dialog. See this section for more information.
Capabilities | Public | Group | Private |
---|---|---|---|
Delete a dialog for all users | Owner | Owner | Owner |