Organizations

Create organization

Creator becomes owner and admins.

create_organization: name: <string>, icon: <opt_string>, brand_color: <opt_string>
    -> { organization: <<organization_record> }

with parameters:

  • name: required organization name. Any string.
  • icon: if not empty, the organization icon will be reset. Icon data should be a complete image data url, e.g. data:image/;base64,. We recommend use only jpeg for photo images and png for graphic art.
  • brand_color: if not empty, set up brand color.

Destroy organization

destroy_organization:(organization_id:<long>)
    -> { organization: <<organization_record> }

with parameters:

  • organization_id: Organization ID

Change organization appearance

update_organization(organization_id: <long>, name: <opt_string>, icon: <opt_string>, brand_color: <opt_string>, allow_forwarding: <opt_boolean>)
    -> { organization: <<organization_record> }
  • organization_id: Organization ID
  • name: if not empty, the organization name will be changed.
  • icon: if not empty, the organization icon will be reset. Icon data should be a complete image data url, e.g. data:image/;base64,. We recommend use only jpeg for photo images and png for graphic art.
  • brand_color: if not empty, set up brand color
  • allow_forwarding: Allow or prohibit message forwarding, default: false

List of organization users

get_organization_users(organization_id:<long>)
    -> { organizations_users: [<<organizations_user_record>,...] }
  • organization_id: Organization ID

List of user organizations

get_organizations()
    -> { organizations: [<<organization_record>, ...] }

Invite to the organization

Only the administrator has execute rights.

organization_invite(organization_id:<long>,user_id:<long>) 
    -> {organizations_user: <<organizations_user_record>}

where

  • organization_id: Organization ID
  • user_id: ID of the user who is invited to the organization

on success, returns the user_organization_record of newly added user, send a notification of the new user in organization.

When a user is added to an organization, he automatically becomes a subscriber to all public chats of organizations.

Change user role

Only the administrator has execute rights.

Unless other user is a organization owner, admin can change other users roles, also promoting them to admin.

organization_access(organization_id:<long>, user_id:<long>, role:<string)
    ->{organizations_user: <<organizations_user_record> }
  • organization_id: Organization ID
  • user_id: ID of the user to whom the rights are assigned
  • role: Valid values admin and ro

Owner access can not be changed.

Kick a user out of the organization.

Only the administrator has execute rights.

organization_kick(organization_id:<long>,user_id:<long>)
    -> {}
  • organization_id: Organization ID
  • user_id: ID of the user to whom the rights are assigned

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

The user will exit all chats of the organization.

Leave the organization

organization_leave(organization_id:<long>) -> {}

On successful, the notification of a deleted object is propagated among the group subscribers:

{
    event:'deleted', 
    object_name:'organization',
    object: { id: <<organization_id_record> }
}

The user will exit all chats.

Create organization room

Only the administrator has execute rights.

A room is a general purpose chat. Creator becomes owner and admins. As ususal with universa chat, the result is the subscription of the creator.

create_organization_room(name: <string>, user_ids: [<int>,..], organization_id: <int>, is_space: <opt_boolean>, type: <opt_string>)
    ->{subscription: <<unichat subscription record> }
  • organization_id: Organization ID
  • name: name: required room name. Any string.
  • user_ids: optional array of userid to be invited immediately.
  • is_space: if not empty, the group attribute is_space will be changed. Default value: false.
  • type: Optional. If option is_space is TRUE. Valid values public and private, default: private

List of organization subscriptions

get_organization_subscriptions(organization_id: <int>, short: <booleab>, limit: <int>, offset: <int>)
    ->{subscriptions: [<<unichat subscription record>,...] }
  • organization_id: Organization ID

  • This command supports paging. Sunscriptions are ordered by subscription.id ascending, so just set limit and offset to some non-default values to iterate through subscriptions.

  • set short: true to get subscription information without group participants. the short form carries all the information to show groups bar, while heavy group.participants section is needed only when the group is opened.

For more information, see unichat subscription record for the record structure, and unichat groups and unichat subscriptions for overall explanation.