# Native Contacts

{% hint style="info" %}

<pre data-overflow="wrap"><code>You'll need to import the javascript file in your website before starting from this <a data-footnote-ref href="#user-content-fn-1">link</a>.
</code></pre>

{% endhint %}

**To Retrive All contacts of device.**

{% tabs %}
{% tab title="Plain JS" %}

```
const { contacts } = window.WTN

contacts.getPermissionStatus({
  callback: function(data){
   //data.status contains permission status
  }
 })
 

contacts.getAll({
 callback: function(data){
  //data.contacts contains all contact   
 }
})
```

{% endtab %}

{% tab title="ES 6+" %}

```
import { getPermissionStatus, getAll } from "webtonative/NativeContacts"

getPermissionStatus({
  callback: function(data){
   //data.status contains permission status
  }
 })
 

getAll({
 callback: function(data){
  //data.contacts contains all contact   
 }
})
```

{% endtab %}
{% endtabs %}

**the possible status are**

* **authorized**: Permission has been granted
* **denied**: Permission has been denied
* **restricted**: access has been administratively prohibited
* **notDetermined**: User has not yet been asked for permission

**contacts will be an array of contacts with following keys**

* givenName
* familyName
* middleName
* birthday
* namePrefix
* previousFamilyName
* nameSuffix
* nickname
* organizationName
* departmentName
* jobTitle
* phoneNumbers\* (Array of Objects Described Below)
  * label
  * phoneNumber
* emailAddresses\* (Array of Objects Described Below)
  * label
  * emailAddress
* postalAddresses\* (Array of Objects Described Below)
  * label
  * street
  * subLocality
  * city
  * subAdministrativeArea
  * state
  * postalCode
  * country
  * isoCountryCode

Feature added in Android on 15/03/24

[^1]: <https://docs.webtonative.com/javascript-apis/getting-started>


---

# 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.webtonative.com/javascript-apis/native-contacts.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.
