how can i set a contact’s photo to a picture?

I figured it out. I was encoding the image blob bytes for the payload for some reason. I should have just passed the blob as the payload like this.

const accessToken = ScriptApp.getOAuthToken();
const id = '4c18faa28828aa3f';
const url = '-URL Omitted-';
const blob = UrlFetchApp.fetch(url).getBlob();
const response = UrlFetchApp.fetch(`${id}`, {
  method: 'put',
  contentType: 'image/jpeg',
  payload: blob,
  headers: {
    Authorization: `Bearer ${accessToken}`,
const content = response.getContentText();

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top