Administration

The user having subscription with admin role can administrate the group with methods described below.

Change other user role

Unless other user is a group owner, admin can change other users roles, also promoting them to admin (this could be changed in group settings later).

set_access(subscription_id:<long>,user_id:<long>,role:<string)
    ->{subscription: <updated_user_subscription> }

Where subscription_id is the subscription of the admin to the group to update and user_id is the user to update access. Valid roles are: ro, rw and admin.

When access is changed, temporary readonly mode and temporary ban are cleared.

Owner access can not be changed.

Kick user from a group

kick(subscription_id:<long>,user_id:<long>)
    -> {}

Where subscription_id is the subscription of the admin to the group to change.

It is not allowed to kick owner out of the group. Other admins can be kicked out as well.

Successful kick sends system message xtagged kick_out.

Change group appearance

update_group(subscription_id:<long>,name:<opt_string>,icon: <opt_string>, pinned_message_id: <opt_long>)
    -> { group: <<unichat group record> }
  • name: if not empty, the group name will be changed.
  • icon: if not empty, the group icon will be reset. Icon data should be a complete image data url, e.g. data:image/<subtype>;base64,<data>. We recommend use only jpeg for photo images and png for graphic art.
  • pinned_message_id: message ID. If not empty, pinned message will be changed. To delete, use an empty string.

See unichat subscription record for group record sample.

Create group invite code

The group admin can create a code that allow anybody to join the group. See unichat invite codes for details how to use them.

create_group_invite_code(subscription_id:<long>)
    -> { code: <string> }

If code is already set, this call returns it. To change code, administrator must delete existing code first, them create new one.

The invite code is also available to all participants, if present, it will be included in every group object as:

group: {
    // ...
    invite_code: <string>
    // ...
}

This field will be set to null if the code is not set/deleted. The field could be also missing in some circumstances.

Delete group invite code

Group admin can delete the invite code (see unichat invite codes]):

delete_group_invite_code(subscription_id:<long>) -> {}

If there was no code, it does nothing.