Skip to main content
Use this API to add a new contact to the user’s phone contact list. The user will see a confirmation dialog before the contact is added.

Parameters

PropertyTypeRequiredDescription
firstNameStringYesContact’s first name
lastNameStringNoContact’s last name
nickNameStringNoContact’s nickname
mobilePhoneNumberStringNoMobile phone number
workPhoneNumberStringNoWork phone number
homePhoneNumberStringNoHome phone number
emailStringNoEmail address
workEmailStringNoWork email address
organizationStringNoCompany/organization name
titleStringNoJob title
workAddressStreetStringNoWork street address
workAddressCityStringNoWork city
workAddressStateStringNoWork state/province
workAddressPostalCodeStringNoWork postal code
workAddressCountryStringNoWork country
homeAddressStreetStringNoHome street address
homeAddressCityStringNoHome city
homeAddressStateStringNoHome state/province
homeAddressPostalCodeStringNoHome postal code
homeAddressCountryStringNoHome country
remarkStringNoNotes/remarks
successFunctionNoCallback on success
failFunctionNoCallback on failure
completeFunctionNoCallback that always executes

Code Example

Basic Usage

my.addPhoneContact({
  firstName: 'John',
  lastName: 'Doe',
  mobilePhoneNumber: '+1234567890',
  success() {
    my.showToast({ content: 'Contact added' });
  }
});

Business Contact

my.addPhoneContact({
  firstName: 'Jane',
  lastName: 'Smith',
  mobilePhoneNumber: '+1234567890',
  workPhoneNumber: '+1987654321',
  email: 'jane.smith@example.com',
  workEmail: 'jsmith@company.com',
  organization: 'Acme Corporation',
  title: 'Sales Manager',
  workAddressStreet: '123 Business Ave',
  workAddressCity: 'New York',
  workAddressState: 'NY',
  workAddressPostalCode: '10001',
  workAddressCountry: 'USA',
  success() {
    my.showToast({ content: 'Contact saved successfully' });
  },
  fail(err) {
    my.showToast({ content: 'Failed to save contact', type: 'fail' });
  }
});

Add Store Contact

Page({
  data: {
    store: {
      name: 'Downtown Store',
      phone: '+1234567890',
      address: '456 Main Street',
      city: 'Los Angeles'
    }
  },

  saveStoreContact() {
    const { store } = this.data;
    my.addPhoneContact({
      firstName: store.name,
      mobilePhoneNumber: store.phone,
      workAddressStreet: store.address,
      workAddressCity: store.city,
      remark: 'Added from Mini Program',
      success() {
        my.showToast({ content: 'Store contact saved' });
      }
    });
  }
});
The user will always see a system confirmation dialog before the contact is actually added. This protects user privacy and prevents unwanted contacts.

my.choosePhoneContact

Choose from contacts

my.makePhoneCall

Make phone call