Update User Photo
Definition
The "Update User Photo" action allows you to add or update a user's photo in the Google Directory. This action is ideal for administrators who want to personalize user profiles by uploading profile pictures or updating existing ones. It supports various image formats such as JPEG, PNG, GIF, BMP, and TIFF. The action requires the user's unique identifier or email address and a photo file, which will be resized to fit the system's required dimensions (96x96 pixels). The key capabilities of this action include uploading new photos for users, overwriting existing photos, and ensuring the uploaded photo is in an appropriate format and size.
Example Use Cases
-
User Profile Customization
Administrators can update users' profile pictures to personalize their accounts, making it easier for other employees to recognize them. This can be especially useful in organizations where profile photos enhance collaboration and communication.
-
Onboarding New Employees
When new employees join the company, the admin can upload their photos to the Google Directory to give them a personalized user experience right from the start, helping teams recognize and welcome them.
-
Corporate Rebranding
If a company undergoes a rebranding process and employees are asked to update their profile photos to reflect a new uniform or corporate image, this action can be used to upload updated profile pictures in bulk or individually.
-
Group Visuals for Teams
Teams or departments can assign and update group photos, ensuring that everyone’s profile in Google Directory represents their respective team, making internal searches and visual identification more organized.
-
Syncing Photos from External Sources
If employee photos are stored on external platforms (like Google Drive or OneDrive), administrators can use this action to pull those photos and associate them with the appropriate Google Directory user accounts.
Inputs
-
Connection
This field refers to the authentication connection that you need to establish to Google Directory to execute the action. It ensures the system has access to the required Google services. Typically, this would be the OAuth connection that is set up to authenticate the API requests for your Google services.
-
Id or Email of the User
This field specifies the unique identifier of the user whose photo is being updated. You can provide either:
- User’s Primary Email: The main email address associated with the user's account (e.g., [email protected]).
- Alias Email Address: Any alias or secondary email addresses associated with the user.
- Unique User ID: This is the unique identifier (UID) that Google uses to recognize the user internally (e.g., "12345abcd").
- This identifier can be obtained from other actions such as:
- Create User: After creating a user, their ID or email is available.
- Update User: After updating a user, their ID or email is available.
- Lookup User Information: This can retrieve details about a user based on their email or ID.
-
Photo File
This field requires the upload data of the photo that will be added to the user's profile. The photo file should be in an acceptable image format (JPEG, PNG, GIF, BMP, TIFF).
- The photo can be sourced from a "Get Item Information" action in the Google Drive category.
- The file should be properly downsized to 96x96 pixels (if required) before uploading.
- You can also use the "Find File" action in platforms like Google Drive or OneDrive to fetch the image file if it's already stored there.
Outputs
-
Id
This is the unique ID assigned to the user by the Google Directory API. It is used to reference the user in any future requests to update or retrieve user information. The ID can be used in the user request URI’s userKey for future reference.
-
Primary Email
The primary email address of the user whose photo has been updated. This is the main email address associated with the user's Google account (e.g., [email protected]). This field provides confirmation of which user the photo has been updated for.
-
Photo Data
The upload data of the user's photo, encoded in web-safe Base64 format. This field contains the image data in bytes, allowing the photo to be transmitted or stored in a compatible format. The Base64 encoding is used to ensure the image can be included in data payloads, such as API responses, without issues.
-
Mime Type
The MIME type of the uploaded photo. This field tells you the format of the image (e.g., JPEG, PNG, GIF, BMP, TIFF). The MIME type helps identify the file format, ensuring compatibility when displaying or processing the image.
-
Width
The width of the uploaded user photo in pixels. This field indicates the horizontal size of the image after it has been processed and uploaded. It's typically used to ensure that the image adheres to specific size guidelines or for rendering the image properly in user interfaces.
-
Height
The height of the uploaded user photo in pixels. Similar to the width, this field indicates the vertical size of the image. This value is used to ensure the photo fits within specific size restrictions or is properly displayed in various Google services like Gmail or Google Contacts.
Example of Using the "Update User Photo" Action
Scenario:
You are an administrator for a company that uses Google Workspace. As part of the company's employee onboarding process, you want to ensure that every employee has a professional photo associated with their Google account. You have a collection of employee photos stored in your system, and you'd like to update the photos for all new employees automatically once their accounts are created.
Steps to Set Up:
-
Employee Account Creation:
First, you would create user accounts for your new employees in Google Workspace. This can be done manually or automatically through bulk import.
-
Prepare Employee Photos:
You already have a repository of photos for each employee (possibly stored on Google Drive, OneDrive, or another file storage service). Each photo is properly resized to the correct dimensions and format (JPEG, PNG, etc.).
-
Retrieve Employee Photo:
Use the "Find File" action (from Google Drive or OneDrive category) to locate the employee's photo. The photo should be in a compatible format (JPEG, PNG, etc.) and should be properly resized to 96x96 pixels as required for user profile photos.
-
Invoke the "Update User Photo" Action:
Using the "Update User Photo" action, provide the following input:
- Connection: Connect your Google Workspace account.
- Id or Email of the User: Input the unique user ID or primary email of the employee whose photo you want to update.
- Photo File: Provide the photo file data (Base64 encoded) that was retrieved from the "Find File" action.
-
Execution:
After the action is triggered, the photo for that employee will be updated on their Google Workspace profile. The new photo will appear in services like Gmail, Google Calendar, and Google Contacts.
-
Feedback:
The system will return details about the updated photo, including:
- Id: The unique ID of the user.
- Primary Email: The email address associated with the employee's account.
- Photo Data: The photo’s data in Base64 format.
- Mime Type: The type of photo (e.g., JPEG).
- Width and Height: The dimensions of the updated photo.
Use Case:
This action can be used as part of an automated employee onboarding workflow where, after user account creation, a custom script or automation process can update the employee’s profile photo, ensuring that all users have professional photos associated with their account.
Updated 8 days ago