feat: get contact's profile picture

This commit is contained in:
Pedro Lopez
2020-02-08 01:23:29 -04:00
parent 004312a99f
commit f2b286a319
2 changed files with 13 additions and 0 deletions

View File

@@ -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!

View File

@@ -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<string>}
*/
async getProfilePicUrl() {
const profilePic = await this.client.pupPage.evaluate((contactId) => {
return window.Store.Wap.profilePicFind(contactId);
}, this.id._serialized);
return profilePic ? profilePic.eurl : undefined;
}
}