diff --git a/README.md b/README.md index 3146fb1..62c2a77 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,7 @@ Take a look at [example.js](https://github.com/pedroslopez/whatsapp-web.js/blob/ | Promote/demote group participants | ✅ | | Mention users | _pending_ | | Get contact info | ✅ | +| Get profile pictures | ✅ | Something missing? Make an issue and let us know! diff --git a/src/structures/Contact.js b/src/structures/Contact.js index ccaf682..7cd7dee 100644 --- a/src/structures/Contact.js +++ b/src/structures/Contact.js @@ -91,6 +91,18 @@ class Contact extends Base { return super._patch(data); } + + /** + * Returns the contact's profile picture URL, if privacy settings allow it + * @returns {Promise} + */ + async getProfilePicUrl() { + const profilePic = await this.client.pupPage.evaluate((contactId) => { + return window.Store.Wap.profilePicFind(contactId); + }, this.id._serialized); + + return profilePic ? profilePic.eurl : undefined; + } }