For the complete documentation index, see llms.txt. This page is also available as Markdown.

Contacts

Permission settings are required

fetchContactsBefore using it, you need to set contact permissions. Please first check the permission setup guide.


Fetch Contacts

SDK function: fetchContacts

fetchContactsis a function that fetches the user's contact list page by page.

Signature

function fetchContacts(options: {
  size: number;
  offset: number;
  query?: {
    contains?: string;
  };
}): Promise<ContactResult>;

Parameters

  • options · Required

    This is the options object specified when fetching contacts.

    • options.size · Required

      The number of contacts to fetch at once. For example, if you pass 10, it fetches up to 10 contacts.

    • options.offset · Required

      This is the starting point for the contacts to fetch. When calling it for the first time, 00 nextOffset you should pass. After that, use the

      • options.query · Required

        This is an additional filtering option.

        • options.query.contains · Required

          Use this when you want to fetch only contacts whose names contain a specific string. If you do not pass this value, all contacts are fetched.

Properties

  • openPermissionDialog

    Displays a dialog to request contact read permission again. The user can choose one of "Allow", "Allow Once", or "Don't Allow". If "Allow" or "Allow Once" is selected, allowedit returns deniedis returned.

  • getPermission

    Returns the current status of contact read permission. allowedis the state where the user has granted contact read permission. deniedis the state where the user has denied contact read permission. notDeterminedis the state where a contact read permission request has never been made. If contact permission is denied in the Toss app settings, osPermissionDeniedis returned.

Return value

  • Promise<ContactResult>

Returns an object containing the contact list and pagination information.

  • result: the fetched contact list.

  • nextOffset: the offset value to use for the next call. If there are no more contacts to fetch, null.

  • done: indicates whether all contacts have been fetched. If all have been fetched, true.

Contact Permission Error

Error type: FetchContactsPermissionError

This is an error that occurs when contact permission is denied. When an error occurs, error instanceof FetchContactsPermissionErroryou can check it with.

Signature

Example

Fetch a contact list containing a specific string

This is an example of fetching a contact list. Press the "Check Permission" button to check the current contact read permission. If the user denies permission or the system restricts permission, FetchContactsPermissionErrorit returns. You can press the "Request Permission" button to request contact read permission.

Last updated

Was this helpful?