Examples

Headless Contact Picker (Full Address Books)

For some use cases, you might want to get the entire address book before the user has a chance to review and select the contacts that they want to share with your app.

If your app has a social networking componenet, you’ll need the entire address book so you can look for matches in your own network. Or you may have a CRM and want the user’s address book to be accessible all the time. Or it might be because you’d rather display the contacts in your own UI.

Whatever the use case, you can accomplish it by doing these two things:


Add from Address Book

Waiting for your contacts...

<script src="https://api.cloudsponge.com/widget/localhost-only.js"></script>
<script>
cloudsponge.init({
  // suppress the contacts list UI so that the user doesn't have a chance to select from their address book.
  skipContactsDisplay: true,
  // receive the contacts into your javascript and do what you like with them.
  beforeDisplayContacts: function(contacts, source, owner) {
    $('#exampleContacts').text(JSON.stringify(contacts));
  },
  // OR post the data to the given URL directly:
  webhooks: {
    // the entire address book will be posted to this endpoint:
    beforeDisplayContacts: "http://example.org/contacts"
  }
})
</script>