1

From what I can find, every way described in related questions is now obsolete or requires a user to authenticate/authorize sharing the profile information.

Examples: Retrieving a user's public google/gmail picture | Google Users photos API - get the public user photo without authenticating

However, when I add custom/business inboxes to my Gmail app on Android (from my own hosting/domains, using IMAP, 100% unrelated to Google),
any clients (who are NOT in my Google/Android contacts) that send emails to my business accounts, using their Gmail address, the Gmail app will display their public profile picture.

So, there must be a way I can get anyone's public profile picture by simply providing their email address, even if I have to authenticate through my own account (rather than asking other users to authorize sharing their info).

Does anyone know how this can be done?
Basically, I don't want to have to use the Gmail app to be able to get the picture. I want to do this from outside the Gmail app, programmatically.

(any language, any platform)

Nuno
  • 3,082
  • 5
  • 38
  • 58

1 Answers1

2

The following works for me:

  1. Add the user to your contacts (listed on contacts.google.com)
  2. Retrieve the contact's public photos with the People API

E.g. in Apps Script:

function myFunction() {
  Logger.log(People.People.get("people/cXXXXXXX", {"personFields":"photos"}).photos[0].url)//.coverPhotos[0].url);
}

Or just with the "Try it API" of the People API - return all photos of all your contacts with the following request:

https://developers.google.com/people/api/rest/v1/people.connections/list?apix_params=%7B%22resourceName%22%3A%22people%2Fme%22%2C%22personFields%22%3A%22photos%22%7D

Flimm
  • 136,138
  • 45
  • 251
  • 267
ziganotschka
  • 25,866
  • 2
  • 16
  • 33
  • Thank you. Unfortunately this requires me to add to my contacts, which is something I'd like to avoid. With the Gmail app, none of those senders are in my contacts, not even in the Contact Suggestions / Frequently Contacted (I hope Gmail does not collect all emails of my business clients... those settings are always disabled by me) – Nuno Jan 25 '20 at 17:03
  • I am afraid there is no way around it, at least not with any Google API. – ziganotschka Jan 27 '20 at 08:59