Mesibo User Permissions - Restricting Communication Audience and Other Features

Estimated reading time: 3 minutes

By default, your mesibo users will be able to communicate with all the users of your apps. In addition, all the users can send and receive messages, make calls, create groups, etc. However, if you prefer, you can restrict how your app users communicate and with whom they can communicate.

For example, in a dating or a social app, you may allow two users to communicate with each other only if they match, not otherwise. In addition, you need to break the communication link if they unmatch. You may even configure users to allow messaging but not calls unless they are premium users.

In another example, if you create a chatbot using mesibo chatbot APIs, you may want to disable calls so that users do not make video and voice calls to your chatbot.

You can apply these restrictions using backend APIs by specifying the permissions at the time of user creation or later in useradd or userset operations. For example,

{
  "op": "userset",
  "token": "ptlk9hdel1gqxf3p0s15f5f5gtusldej18tl794suzit",
  "user": {
    "address": "123",

    "permissions": {
      "incoming": true
      "outgoing": true
      "peers": 0,
    }
  }
}

Refer to the User Management backend APIs documentation to learn about all the permissions. Note that, some permissions are true by default and some are false by default.

Restricting Communication Audience

As mentioned earlier, by default, your mesibo users will be able to communicate with all the users of your apps. However, you can restrict with whom they can communicate by setting peers in the user permissions as shown above in the request sample.

peers can be one of the following

Value Description
0 Can communicate with all, default
1 Can only communicate with paired users
2 Can only communicate with contacts
3 Can only communicate with favorites

The user can add any other user as a contact or favorite. However, pairing can only be created by the backend APIs as explained in the next section. For setting user as a contact or a favorite, refer to the Contact Management APIs.

Pairing Users

You can pair any user with another user using backend APIs by specifying the contacts at the time of user creation or later in useradd or userset operations.

For example, you can pair user 123 with user 456 by using the following backend request

{
  "op": "userset",
  "token": "ptlk9hdel1gqxf3p0s15f5f5gtusldej18tl794suzit",
  "user": {
    "addr": "123",
    "contact": {
      "address": "456",
      "contact": true,
      "subscribe": true,
      "pair": true,
      "block": false,
      "remove": true
    }
  }
}

Note that, you need to pair both ways.

Similarly, you can unpair, block and remove 123 from the contact list of 456 by using the following backend request

{
  "op": "userset",
  "token": "ptlk9hdel1gqxf3p0s15f5f5gtusldej18tl794suzit",
  "user": {
    "addr": "123",
    "contact": {
      "address": "456",
      "contact": false,
      "subscribe": false,
      "pair": false,
      "block": true,
      "remove": true
    }
  }
}
message backup, restore, migration