Skip to main content
@capgo/capacitor-contacts Device APIs Open source

Contacts Capacitor plugin

Access and manage device contacts with read and write capabilities

Install

bun add @capgo/capacitor-contacts bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-contacts
  • pnpm add @capgo/capacitor-contacts
  • yarn add @capgo/capacitor-contacts

Guide

How to use Contacts in Capacitor

Using @capgo/capacitor-contacts

Capacitor Contacts Plugin interface for managing device contacts.

Install

bun add @capgo/capacitor-contacts
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { CapacitorContacts } from '@capgo/capacitor-contacts';

API at a glance

Method Description
countContacts Count the total number of contacts on the device.
createContact Create a new contact programmatically.
createGroup Create a new contact group.
deleteContactById Delete a contact by ID.
deleteGroupById Delete a group by ID.
displayContactById Display a contact using the native contact viewer.
displayCreateContact Display the native create contact UI.
displayUpdateContactById Display the native update contact UI for a specific contact.
getAccounts Get all accounts available on the device.
getContactById Get a specific contact by ID.
getContacts Get all contacts from the device.
getGroupById Get a specific group by ID.
getGroups Get all contact groups.
isAvailable Check if contacts are available on the device.
isSupported Check if the plugin is supported on the current platform.
openSettings Open the device's contacts settings.
pickContact Pick a single contact using the native contact picker.
pickContacts Pick one or more contacts using the native contact picker.
updateContactById Update an existing contact by ID.
checkPermissions Check the current permission status for contacts.
requestPermissions Request permissions to access contacts.

Examples

countContacts()

Count the total number of contacts on the device.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

const result = await CapacitorContacts.countContacts();
console.log(result);

createContact()

Create a new contact programmatically.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

const result = await CapacitorContacts.createContact({ contact: {} });
console.log(result);

createGroup()

Create a new contact group.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

const result = await CapacitorContacts.createGroup({ group: { name: 'example' } });
console.log(result);

deleteContactById()

Delete a contact by ID.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

await CapacitorContacts.deleteContactById({ id: 'id-123' });

deleteGroupById()

Delete a group by ID.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

await CapacitorContacts.deleteGroupById({ id: 'id-123' });

displayContactById()

Display a contact using the native contact viewer.

import { CapacitorContacts } from '@capgo/capacitor-contacts';

await CapacitorContacts.displayContactById({ id: 'id-123' });

The table above lists the 21 core methods. Listener and version helpers, and the full contract of each method, are documented in the GitHub repository.

Full reference

Keep going from Using @capgo/capacitor-contacts

If you are using Using @capgo/capacitor-contacts to plan dashboard and API operations, connect it with @capgo/capacitor-contacts for the implementation detail in @capgo/capacitor-contacts, Getting Started for the implementation detail in Getting Started, API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, and API Keys for the implementation detail in API Keys.

FAQ

Contacts plugin FAQ

How do I install the Contacts plugin in a Capacitor app?

Run "bun add @capgo/capacitor-contacts" (or "npm install @capgo/capacitor-contacts"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-contacts" in your app code.

Does @capgo/capacitor-contacts work with React, Vue and Angular?

Yes. Contacts is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-contacts support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-contacts free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-contacts/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Contacts without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Contacts changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo