Skip to main content

Lovable Prompt

Add native contact access functionality to retrieve users’ device contacts including names and phone numbers using the Despia SDK from: https://www.npmjs.com/package/despia-nativeFirst, install the package: npm install despia-nativeThen import it: import despia from 'despia-native'
  1. Request contact permission using despia("requestcontactpermission://")
  2. Read contacts using await despia('readcontacts://', ['contacts']) which returns a JSON object with contact names as keys and phone number arrays as values
  3. When accessing the data, use “dot notation” like .contacts to retrieve the contact data in a JSON object format. Here is an example of the structure returned:
This feature requires native capabilities which will be fully provided by the “despia-native” npm package, no additional native libraries are needed!
Please follow the installation instructions for the “despia-native” npm package closely, and do not modify my instructions. Implementation as mentioned is critical.
How it works: The Despia SDK provides native bridge functionality to access device contacts through async method calls. First request permission, then read contacts data which returns as a JSON object with contact names as keys and arrays of phone numbers as values.

Installation

Install the Despia package from NPM:

Usage

1. Import the SDK

2. Request Permission and Read Contacts

Access Native Device Contacts and process them:

Resources

  • NPM Package
  • View full NPM documentation for additional configuration options

Lovable Integration

This SDK is optimized for Lovable’s prompt-based AI builder, enabling quick integration of native contact access into your generated apps. For additional support or questions, please contact our support team at support@despia.com