fetchUserContacts
This method provides a list of contact objects identifying all entities who previously granted authorization to a specified entity to send them email messages. Each contact contains the contact's ETH address as well as the ETH address for the protectedData containing their email address.
Usage
const contactsList = await web3mail.fetchUserContacts({
userAddress: '0x789cba...',
});Parameters
import { type FetchUserContactsParams } from '@iexec/web3mail';userAddress Required *
Type: Address
The user for which you wish to obtain the list of contacts.
const contactsList = await web3mail.fetchUserContacts({
userAddress: '0x789cba...',
});isUserStrict Optional
Type: boolean
This parameter enables fetching contacts who granted access exclusively to the user and no one else.
TIP
When someone grants access, you can choose to grant access to a specific user (a wallet) or to any user (0x0000000000000000000000000000000000000000).
const contactsList = await web3mail.fetchUserContacts({
userAddress: '0x789cba...',
isUserStrict: true,
});bulkOnly Optional
Type: boolean
Default: false
When set to true, this parameter filters contacts to only return those who have granted access with bulk processing capability. These contacts can be used with prepareEmailCampaign and sendEmailCampaign for bulk campaigns.
WARNING
To enable bulk processing, recipients must grant access with allowBulk: true when calling grantAccess on the Data Protector SDK.
// Fetch contacts with bulk access for a specific user
const bulkContacts = await web3mail.fetchUserContacts({
userAddress: '0x789cba...',
bulkOnly: true,
});Return Value
The result object contains a list of contact objects. Each contact represents one user who previously granted authorization for the user identified with userAddress to send them messages.
import { type Contact } from '@iexec/web3mail';