All Products
Search
Document Center

SuperApp:Contacts

Last Updated:Jun 02, 2026

The WVContacts JS API provides methods for managing contact permissions and contact data in H5 applications and mini programs.

WVContacts.askAuth

Note

This API is available only on WindVane for iOS.

Requests authorization to access the device's contacts.

Parameters

This method takes no parameters.

Callback parameters

On devices running iOS 6 or later, the success callback is always triggered and returns the authorization status. On earlier iOS versions, no callback is triggered and no authorization request is made.

  • [int] isAuthed: Whether the user granted authorization. 0: not granted. 1: granted.

window.WindVane.call('WVContacts', 'askAuth', {}, function(e) {
        alert(JSON.stringify(e));
});

WVContacts.authStatus

Returns the current authorization status for accessing contacts.

Parameters

This method takes no parameters.

Callback parameters

The success callback is always triggered.

  • [int] isAuthed: Whether authorization has been granted. 0: not granted. 1: granted.

  • [int] status: (iOS only) The detailed authorization status on iOS. Valid values:

    • 0: Not Determined.

    • 1: Restricted.

    • 2: Denied.

    • 3: Authorized.

window.WindVane.call('WVContacts', 'authStatus', {}, function(e) {
        alert(JSON.stringify(e));
});

WVContacts.choose

Opens the device's contact list so the user can select a contact, then returns the selected contact's name and phone number to the H5 application.

Parameters

This method takes no parameters.

Callback parameters

The success callback is triggered when the user selects a contact. The failure callback is triggered if the user cancels.

  • [string] name: The name of the selected contact.

  • [string] phone: The phone number of the selected contact.

window.WindVane.call('WVContacts', 'choose', {}, function(e) {
        alert('success: ' + JSON.stringify(e));
}, function(e) {
        alert('failure: ' + JSON.stringify(e))
});

WVContacts.find

Searches contacts by name, phone number, or both.

Parameters

  • [object] filter: The search criteria. Contains the following properties:

    • [string] name: Optional. Matches contacts whose name contains this string (partial match on iOS).

    • [string] phone: Optional. Matches contacts whose phone number contains this string (partial match on iOS).

When both name and phone are specified, only contacts that match both criteria are returned. If a contact has multiple phone numbers, each matching number appears as a separate entry in the results.

Note

On iOS, this method performs a partial match. For name, it matches contacts whose name contains the specified string. The same logic applies to phone numbers.

Callback parameters

The success callback is always triggered.

  • [array] contacts: Contacts matching the filter. Each item contains:

    • [string] name: The contact's name.

    • [string] phone: The contact's phone number.

var params = {
        // Search criteria.
        filter: {
                // Match contacts by name.
                name: 'John',
                // Match contacts by phone number.
                phone: '123456'
        }
}
window.WindVane.call('WVContacts', 'find', params, function(e) {
        alert(JSON.stringify(e));
});

WVContacts.addPhoneContact

Note

This API is available only on WindVane for Android 1.0.3.4 and later.

Adds a new contact to the device's contact list.

Parameters

  • [string] lastName: Required. The contact's last name.

  • [string] firstName: Required. The contact's first name.

  • [string] middleName: Optional. The contact's middle name.

  • [string] nickName: Optional. The contact's nickname.

  • [string] remark: Optional. A note about the contact.

  • [string] mobilePhoneNumber: Optional. The contact's mobile phone number.

  • [string] hostNumber: Optional. The contact's company or home phone number.

  • [string] address: Optional. The contact's address.

  • [string] email: Optional. The contact's email address.

  • [string] organization: Optional. The contact's organization.

  • [string] title: Optional. The contact's job title.

  • [string] photoPath: Optional. The local file path to the contact's photo.

Callback parameters

On success:

  • None.

On failure:

  • [string] msg: The error message.

var params = {
  lastName: 'Smith',
  firstName: 'John',
  middleName: 'Michael',
  nickName: 'Johnny',
  remark: 'Met at conference',
  mobilePhoneNumber: '+86 13800138000',
  hostNumber: '010-12345678',
  address: 'Beijing, Chaoyang District',
  email: 'john.smith@example.com',
  organization: 'Alibaba Cloud',
  title: 'Software Engineer',
  photoPath: '/storage/emulated/0/DCIM/Camera/photo.jpg'
}

window.WindVane.call('WVContacts', 'addPhoneContact', params, function(e) {
}, function(e) {
        alert('failure: ' + JSON.stringify(e))
});