Contact
Represents a WhatsApp contact with their profile information.Contact ID in either LID or JID format (preferred)Examples:
"[email protected]"(JID format)"1234567890@lid"(LID format)
Contact ID in LID format onlyExample:
"1234567890@lid"Contact ID in phone number formatExample:
"[email protected]"Name of the contact as you have saved it on your WhatsAppThis is the name you manually set for this contact in your phone’s contacts.
Name that the contact has set for themselves on WhatsAppThis is their WhatsApp display name, set by them in their profile.
Verified business name (for business accounts)Only present for verified business accounts.
URL of the contact’s profile pictureBaileys-specific addition. Possible values:
"changed"- Profile picture has been updatednull- No profile picture set (using default)string- URL to the profile picture
Contact’s WhatsApp status messageBaileys-specific addition. Contains the “About” text from the contact’s profile.
Usage Examples
Basic Contact Information
Handling LID and Phone Number Formats
Profile Picture Status
Business Account Detection
Events Emitting Contacts
Contacts are emitted in these events:contacts.upsert
New contacts added to your contact list:contacts.update
Existing contacts updated:messaging-history.set
Contacts synced from history:Fetching Contact Information
Use socket methods to fetch contact information:Best Practices
ID Format Preference
ID Format Preference
Always prefer the LID format when available:LID (Local Identifier) is more stable than phone number-based JIDs.
Name Display Priority
Name Display Priority
Show names in this order of preference:
contact.name(your saved name) - most personalcontact.notify(their display name) - their choicecontact.verifiedName(business name) - official name- Phone number extracted from
contact.id
Profile Picture Caching
Profile Picture Caching
Profile picture URLs can expire. Cache them but implement refresh logic:
Contact Storage
Contact Storage
Store contacts in your database for offline access: