Create a public/group/private dialog.
Create private dialog
1. Set a private dialog type
type
parameter to set a dialog type. Set it to 3
to create a private dialog.2. Set the ID of the opponent
occupants_ids
parameter to set the ID of the opponent who is going to participate in the dialog.3. As a result, the API returns a newly created private dialog.
Create public dialog
1. Set a public dialog type
type
parameter to set a dialog type. Set it to 1
to create a public dialog.2. Set a name of the public dialog
name
parameter to set a name for the group dialog.3. Set an avatar for the dialog
photo
field.4. As a result, the API returns a newly created public dialog.
Create group dialog
1. Set a group dialog type
type
parameter to 2
to create a group dialog.2. Set a name of the group dialog
name
parameter to set a name for the group dialog.3. Set IDs of opponents
occupants_ids
parameter to set a list of opponents IDs who are going to participate in the dialog.4. As a result, the API returns a newly created group dialog.
Create dialog with custom parameters
1. Set a type of the dialog
type
parameter. Here, a group
dialog is created since the type
is set to 2
.2. Set a name of the dialog
3. Set IDs of opponents
occupants_ids
parameter to set a list of opponents IDs who are going to participate in the dialog.4. Use a `data` parameter to refer to a custom object that should be added
data
stores a set of unique keys each having an associated value parameter.5. Set a name of the class
ScoreTable
custom object class.6. Set custom object fields
ScoreTable
class.7. As a result, the API returns a newly created dialog with the specified custom parameters.
Create group dialog with API key
1. Use 'Authorization' header to pass API key
2. Use 'On-Behalf-Of' header to pass user id
3. Set a group dialog type
type
parameter to 2
to create a group dialog.4. Set a name of the group dialog
5. Set IDs of opponents
occupants_ids
parameter to set a list of opponents IDs who are going to participate in the dialog.6. As a result, the API returns a newly created group dialog.
Create private dialog with API key
1. Use 'Authorization' header to pass API key
2. Use 'On-Behalf-Of' header to pass user_id
3. Set a private dialog type
type
parameter to set a dialog type. Set it to 3
to create a private dialog.4. Set the ID of the opponent
occupants_ids
parameter to set the ID of the opponent who is going to participate in the dialog.5. As a result, the API returns a newly created private dialog.
Create public dialog with API key
1. Use 'Authorization' header to pass API key
2. Use 'On-Behalf-Of' header to pass user_id
3. Set a public dialog type
type
parameter to set a dialog type. Set it to 1
to create a public dialog.4. Set a name of the public dialog
5. Set an avatar for the dialog
6. As a result, the API returns a newly created public dialog.
type=1
(PUBLIC_GROUP) to create a public dialog. All users from your application will be able to join it. The server will create a public chat and return a detailed information about the newly created dialog. Field xmpp_room_jid
will contain a Chat room JID to which you should connect to start chatting.
Use type=2
(GROUP) to create a group dialog only for specific users provided in occupants_ids
. The server will create a group chat (involving only members of this chat) and return a detailed information about the newly created dialog. Field xmpp_room_jids
will contain a Chat room JID to which you should connect to start chatting.
Use type=3
(PRIVATE) to create a private dialog between 2 users. The server will return a detailed information about the newly created dialog. If a user sends a chat message to some user and the private dialog wasn’t created, it will be created automatically with the first chat message.
Custom parameters
Dialogs can store additional parameters. These parameters can be used to store additional data. Also, these parameters can be used in dialogs retrieval requests.
To start using additional parameters, create an additional schema of your parameters. This is a custom objects class. Just create an empty class with all fields that you need. These fields will be your dialog’s additional parameters.
Next, to set additional parameters to a dialog, use next additional parameters in a creation request:
data[class_name]
- should contain Custom Objects class name created above.data[...]
data[{field_name_N}]
- field N from Custom Object class.
1
: PUBLIC_GROUP - 2
: GROUP - 3
: PRIVATE type=3
(PRIVATE). The maximum length is 200 symbols. ApiKey {your_api_key}
. Must be used either QB-Token or Authorization.201
400
422