# Contacts

* [Bubble.io Plugin](#bubble.io-plugin)
* [JavaScript SDK](#javascript-sdk)

### 🧋 Bubble.io Plugin

#### Natively - Contacts

!!! YOU NEED TO SET "ContactsObject (Natively - ... " into element field

<figure><img src="https://3352617162-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F90tV7pYflEQdiAr2VfWu%2Fuploads%2FptM7fYt0fLlRJvpLpv7V%2Fimage.png?alt=media&#x26;token=97dd5fdf-214e-4702-8f80-688216d05d13" alt=""><figcaption></figcaption></figure>

#### Events:

* Get All Contacts Success
* Get All Contacts Failed
* Create Contact Success
* Create Contact Failed

#### States:

* Get Contacts Result - list of ContactObject's
  * ContactObject:
    * FirstName
    * LastName
    * Phones - Array of contacts phone numbers, if there are 2 or more phone numbers, it's separated by a comma (example: "05435235235,124334234")
    * Emails - Array of contacts emails. If there are 2 or more emails, it's separated by a comma (example: "<test@test.co>,<build@natively.co>")
    * ID - unique contact identifier on these device.
* Create Contact ID Result - Id of created contact after calling **Create Contact** action
* Create/Get Contacts Status - Result status after calling **Create Contact** or **Get all contacts**

#### Actions:

* Get All Contacts - response: list of ContactObject's
* Create Contact - response: Contact ID
  * First name - **Required**
  * Last name
  * Phone
  * Email
* Get Contact By ID - response: list of ContactObject's

###

### 🛠 JavaScript SDK

#### NativelyContacts

{% code overflow="wrap" lineNumbers="true" %}

```javascript
const contacts = new NativelyContacts()
const contacts_save_callback = function(resp) {
        console.log(resp.id);
        console.log(resp.status);
};
const contacts_all_callback = function (resp) {
        console.log(resp.contacts);
        console.log(reps.status); // "SUCCESS"/"FAILED"
};
contacts.getAllContacts(contacts_all_callback);
contacts.createContact(contacts_save_callback);
```

{% endcode %}
