Contact Management and Profile Synchronization

An app can have millions of users. However, each user of the app is only communicating with a set of users. Even within this set, only a few users with whom the user may be interested in receiving updates. Also, there are users with whom the user does not want to communicate at all.

Similarly, not every user may wish to disclose their information to all others. Effectively managing these preferences and ensuring synchronization for millions of users is a complex task that mesibo makes very easy.

The mesibo profile synchronization APIs allow you to achieve it easily - defining relations between two users and which information flows between them (access levels). Once you define it, mesibo APIs will start synchronizing profile information between users. For example, when user A updates their profile, user B will get a notification instantly in real-time, etc.

Relationship between Two Users

You can define the following relationship between two users:


User A can subscribe to the profile updates of user B. Depending on the privacy and visibility settings of user B, whenever user B updates their profile, user A will be informed in real-time.


User A adds User B as a contact with specific access levels. This allows User B to view parts of User A's profile based on the access level.


If restricted communication is enabled for user A, user A can only communicate with user B if they are paired. The pairing cannot be set by the user and can only be set by the backend APIs. Refer to Restricted Communication APIs for more details.


If user A blocks user B, they can not communicate with each other.

Using Contact Management APIs

You can use mesibo profile APIs to add a user as a contact, subscribe, and set the access level.

MesiboProfile profile = Mesibo.getProfile("remote_user");

That's it! remote_user is now added as a contact and also subscribed to. It has been granted access levels 1, 2 and 5. Your app will start getting updates whenever the user updates their profile. Similarly, the remote user will also start getting updates about your profile.

Bulk Contact Synchronization

If you are creating a messenger app like WhatsApp or Telegram which uploads your entire phone book as contacts so that your contacts can view your name, image, status, etc., and can find other app users. In such cases, using the above profile API will be quite slow and instead, you should use the bulk contact synchronization class MesiboContactSynchronizer. For example,

String[] contacts = {"18005550001", "18005550002", "18005550003"};

MesiboContactSynchronizer *syncer = new MesiboContactSynchronizer();
syncer.sync(contacts, true);

The above example synchronizes multiple contacts defined in the contacts array with access levels 1,2,5 and also subscribes to their update.

Incremental Sync

The sync() function takes a second parameter that controls when the sync happens. If you pass true, the sync will happen immediately. However, often it is optimized to incrementally add contacts (for example, from another source like phone contacts), and then sync them all at once later.

To do this, you would pass false as the second parameter to add contacts without syncing yet. Then call syncNow() after adding all contacts to trigger the actual sync.

// keep adding contacts to sync queue
while((contacts = readContacts()) != null) { 
    syncer.sync(contacts, false);

syncer.syncNow(); //sync now

Sync As Update

In some cases, you may want to update the synchronization preferences instead of overwriting them completely. For example, if you are syncing phone contacts with public access for all, but a contact was previously granted a higher privileged access level, the sync() API would revoke that higher access level by overwriting with just public access.

To avoid this, you can use syncAsUpdate() instead of sync(). The syncAsUpdate() function will add to the existing preferences instead of overwriting them. So in the example, it would keep the higher access level instead of downgrading to public access only.

// keep adding contacts to sync queue
while((contacts = readContacts()) != null) { 
    syncer.syncAsUpdate(contacts, false);

syncer.syncNow(); //sync now

Automatic Contact Synchronization

mesibo automatically syncs and subscribes to profiles when you receive messages from users or access profiles. This ensures you have their updated profiles.

Automatic sync is enabled by default and recommended. You can disable it with:


Adding Non-existing users as contacts

In addition to existing users, contact management APIs allow you to subscribe to non-existing users and add them as a contact for the future. This allows you to be notified automatically when those contacts join the app (for example, in the WhatsApp or Telegram app, you are notified when one of your contacts joins the app).