Skip to main content
The Contact List API is rather straightforward. User A sends a request to become “friends” with user B. User B accepts the friend request. And now user A and B appear in each other’s roster. Visit Key Concepts page to learn the most important QuickBlox concepts.

Before you begin

  1. Register a QuickBlox account. This is a matter of a few minutes and you will be able to use this account to build your apps.
  2. Configure QuickBlox SDK for your app. Check out Setup page for more details.
  3. Create a user session to be able to use QuickBlox functionality. See Authentication page to learn how to do it.
  4. Connect to the Chat server. See Connection page to learn how to do it.

Access contact list

You can access the contact list on your login to chat. The contact list object will be returned in callback. Also, the following function gives you an access to contact list.
JavaScript

Add user to your contact list

To add a user to the contact list, use the add() method.
JavaScript
Maximum number of contacts is 300.
Another user will receive a request to be added to the contact list. The onSubscribeListener callback will be called.
JavaScript

Confirm the contact request

To confirm the request, use the confirm() method.
JavaScript
A user will be informed that you have accepted the contact request by the onConfirmSubscribeListener callback.
JavaScript

Reject the contact request

To reject the request, use the reject() method.
JavaScript
A user will be informed that you have declined the contact request by onRejectSubscribeListener callback.
JavaScript

Remove user from the contact list

To remove a previously added user from the contact list, use the following method.
JavaScript

Contact list updates

You can also track contact list updates in real-time by using the code snippet below.
JavaScript