# 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>
