# Contact

If your application is using the core implementation type, you can use the **TapCoreContactManager** class to manage your user's contacts.

| TapTalk Contact Method                                                                          | Description                                                                    |
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| [​Get All User Contact​](#get-all-user-contact)                                                 | Get all of the user's contact data from TapTalk.io                             |
| [​Get Contact Detail Info with TapTalk User ID​](#get-contact-detail-info-with-taptalk-user-id) | Get a detailed contact info with selected TapTalk.io user ID                   |
| [​Get Contact Detail Info with Client User ID​](#get-contact-detail-info-with-client-user-id)   | Get a detailed contact info with selected Client user ID (xcUserID)            |
| [​Add User to Contact with User ID​](#add-user-to-contact-with-user-id)                         | Add a user with selected TapTalk.io user ID to the active user's contacts      |
| [​Add User to Contact with Phone Number​](#add-user-to-contact-with-phone-number)               | Add a user with selected phone number to the active user's contacts            |
| [​Remove User from Contact​](#remove-user-from-contact)                                         | Remove a user with selected TapTalk.io user ID from the active user's contacts |
| [Get User Contact by Username](#remove-user-from-contact-1)                                     | Get user's contact by username                                                 |
| [Get Filtered User Contacts](#remove-user-from-contact-2)                                       | Search user's contact list                                                     |
| [Report User](#report-user)                                                                     | Submit a report for a selected user                                            |
| [Report Message](#report-message)                                                               | Submit a report for a selected message                                         |
| [Block User](#block-user)                                                                       | Block a user from sending or receiving messages                                |
| [Unblock User](#unblock-user)                                                                   | Unblock a blocked user                                                         |
| [Get Blocked User List](#get-blocked-user-list)                                                 | Retrieve a list of blocked users                                               |
| [Get Blocked User IDs](#get-blocked-user-ids)                                                   | Retrieve a list of IDs from blocked users                                      |

### Get All User Contact <a href="#get-all-user-contact" id="get-all-user-contact"></a>

Get all of the user's contact data from TapTalk.io.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreContactManager.getAllUserContacts({
   onSuccess: (contactList) => {
          // do action here
    },
    onError: (errorCode, errorMessage) => {
          // do action here
    }
})
```

{% endtab %}
{% endtabs %}

### Get Contact Detail Info with TapTalk User ID <a href="#get-contact-detail-info-with-taptalk-user-id" id="get-contact-detail-info-with-taptalk-user-id"></a>

Get a detailed contact info with selected TapTalk.io user ID.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreContactManager.getUserDataWithUserID(USER_ID, {
   onSuccess: (response) => {
          // do action here
    },
    onError: (errorCode, errorMessage) => {
          // do action here
    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**&#x20;

`USER_ID`: (String) Taptalk.io User ID of the selected user
{% endhint %}

### Get Contact Detail Info with Client User ID <a href="#get-contact-detail-info-with-client-user-id" id="get-contact-detail-info-with-client-user-id"></a>

Get a detailed contact info with selected Client user ID (xcUserID).

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreContactManager.getUserDataWithXCUserID(XC_USER_ID, {
   onSuccess: (response) => {
          // do action here
    },
    onError: (errorCode, errorMessage) => {
          // do action here
    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**&#x20;

`XC_USER_ID`: (String) Client User ID of the selected user
{% endhint %}

### Add User to Contact with User ID <a href="#add-user-to-contact-with-user-id" id="add-user-to-contact-with-user-id"></a>

Add a user with selected TapTalk.io user ID to the active user's contacts.

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreContactManager.addToTapTalkContactsWithUserID(USER_ID, {
   onSuccess: (response) => {
          // do action here
    },
    onError: (errorCode, errorMessage) => {
          // do action here
    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**&#x20;

`USER_ID`: (String) Taptalk.io User ID of the contact to be added
{% endhint %}

### Add User to Contact with Phone Number <a href="#add-user-to-contact-with-phone-number" id="add-user-to-contact-with-phone-number"></a>

Add a user with selected phone number to the active user's contacts.JavaKotlin

{% tabs %}
{% tab title="JavaScript" %}

```javascript
tapCoreContactManager.addToTapTalkContactsWithPhoneNumber(PHONE_NUMBER, {
   onSuccess: (response) => {
          // do action here
    },
    onError: (errorCode, errorMessage) => {
          // do action here
    }
})
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Parameters**&#x20;

`PHONE_NUMBER`: (String) phone number of the contact to be added
{% endhint %}

### Remove User from Contact <a href="#remove-user-from-contact" id="remove-user-from-contact"></a>

Remove a user with selected TapTalk.io user ID from the active user's contacts.

```javascript
tapCoreContactManager.removeFromTapTalkContacts(userID, {
   onSuccess: (response) => {
          // do action here
    },
    onError: (errorCode, errorMessage) => {
          // do action here
    }
})
```

{% hint style="info" %}
**Parameters**&#x20;

`USER_ID`: (String) Taptalk.io User ID of the contact to remove
{% endhint %}

### **Get User Contact by Username** <a href="#remove-user-from-contact" id="remove-user-from-contact"></a>

Call this method to get User Contact by username.

```javascript
tapCoreContactManager.getUserByUsername(USERNAME, ignoreCase, {
   onSuccess: (response) => {
          // do action here
    },
    onError: (errorCode, errorMessage) => {
          // do action here
    }
})
```

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`USERNAME`**: (String) username\
\&#xNAN;**`IGNORE_CASE`**: (Boolean) ignore case username
{% endhint %}

### **Get Filtered User Contacts** <a href="#remove-user-from-contact" id="remove-user-from-contact"></a>

Call this method to search user's contact list.

```javascript
tapCoreContactManager.getFilterUserContacts(contactString, {
   onContactFound: (contactList) => {
          // do action here
    },
    onContactNotFound: () => {
          // do action here
    }
})
```

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`CONTACT_STRING`**: (String) keyword
{% endhint %}

### Report User

You may call this method to submit a report for a selected user. Submitted reports can then be viewed through the dashboard.

```javascript
tapCoreContactManager.reportUser(
    USER_ID, 
    CATEGORY, 
    IS_OTHER_CATEGORY, 
    REASON,
    {
        onSuccess : (response) => {
            // Successfully reported user
        },
        onError : (errorCode, errorMessage) => {
        
        }
    }
)
```

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`USER_ID`**: (String) ID of the user to report\
\&#xNAN;**`CATEGORY`**: (String) Category of the violation. max length is 100 characters\
\&#xNAN;**`IS_OTHER_CATEGORY`**: (Boolean) If the category is other than the predefined categories\
\&#xNAN;**`REASON`**: (String) reason why the user is reported
{% endhint %}

### Report Message

You may call this method to submit a report for a selected message. Submitted reports can then be viewed through the dashboard.

```javascript
tapCoreContactManager.reportMessage(
    MESSAGE_ID,
    ROOM_ID,
    CATEGORY, 
    IS_OTHER_CATEGORY, 
    REASON,
    {
        onSuccess : (response) => {
            // Successfully reported message
        },
        onError : (errorCode, errorMessage) => {

        }
    }
)
```

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`MESSAGE_ID`**: (String) unique server ID of the message to report\
\&#xNAN;**`ROOM_ID`**: (String) ID of the room where the message belongs to\
\&#xNAN;**`CATEGORY`**: (String) Category of the violation. max length is 100 characters\
\&#xNAN;**`IS_OTHER_CATEGORY`**: (Boolean) If the category is other than the predefined categories\
\&#xNAN;**`REASON`**: (String) reason why the message is reported
{% endhint %}

### Block User

You may block a user to stop conversation flow with the blocked user. Blocked users will not be able to send and receive message, or retrieve profile info from the active user.

```javascript
tapCoreContactManager.blockUser(
    USER_ID,
    {
        onSuccess : (response) => {
            // Successfully blocked user
        },
        onError : (errorCode, errorMessage) => {

        }
    }
)
```

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`USER_ID`**: (String) ID of the user to block
{% endhint %}

### Unblock User

You may unblock a blocked user to let them send and receive message from the active user.

```javascript
tapCoreContactManager.unblockUser(
    USER_ID,
    {
        onSuccess : (response) => {
            // Successfully unblocked user
        },
        onError : (errorCode, errorMessage) => {

        }
    }
)
```

{% hint style="info" %}
**Parameters**\
\&#xNAN;**`USER_ID`**: (String) ID of the user to unblock
{% endhint %}

### Get Blocked User List

You may call this method to retrieve a list of blocked users.

```javascript
tapCoreContactManager.getBlockedUserList({
    onSuccess: (response) => {
        // Successfully retrieved blocked users
    },
    onError: (errorCode, errorMessage) => {
    
    }
});
```

### Get Blocked User IDs

You may call this method to retrieve a list of IDs from blocked users.

```javascript
tapCoreContactManager.getBlockedUserIDs({
    onSuccess: (res) => {
        // Successfully retrieved blocked user IDs
    },
    onError: (errCode, errMes) => {
    }
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.taptalk.io/powertalk-chat-sdk-documentation/powertalk-javascript-sdk/contact.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
