我們即將停用內部部署 API。請參閱我們的內部部署 API 停用文件以取得詳細資訊,並瞭解如何轉移到我們的新一代雲端 API。

Profile: Photo

/v1/settings/profile/photo

Use this endpoint to manage your profile photo.

Before You Start

You must use the admin account to access the profile settings.

The WhatsApp Business API client scales and crops uploaded profile photos to be a square with a max edge of 640px and max size of 5MB before uploading to our servers. Images with a height or width of less than 192px may cause issues when the resizing occurs, because of this, an image size of 640x640 is recommended.

Retrieving

You can retrieve an existing profile photo in the following ways:

  • In the WhatsApp app, click on Chat with business account, then click on the name at the top to see the complete contact information, including the profile photo.
  • Use the WhatsApp Business API's /v1/settings/profile/photo endpoint to retrieve the image that you are using as your profile photo as either base64-encoded binary content or as a public URL of the image.

The image returned will be a thumbnail version of the profile photo.

Example

To get the photo binary, make the following API call:

GET /v1/settings/profile/photo

A successful response contains the base64-encoded binary of the profile photo.

Content-Type: mage/jpeg, or other appropriate type
Content-Length: content-size

binary-image-content

To get the photo URL, make the following API call:

GET /v1/settings/profile/photo?format=link

A successful response contains the public URL of the profile photo.

{
    "settings": {
        "profile": {
            "photo": {
                "link": "profile-photo-url"
            }
        }
    }
}

Updating

To change your profile photo using the API, send the raw image to the /v1/settings/profile/photo endpoint.

Example

POST /v1/settings/profile/photo
Content-Type: image/jpeg //or other appropriate type

your-binary-image-content

The cURL should look like:

curl -X POST \
  https://your-webapp-hostname:your-webapp-port/v1/settings/profile/photo \
  -H 'Authorization: Bearer your-auth-token \
  'Content-Type: image/png' 
  --data-binary @your-path-to-image

A successful request returns the HTTP Status Code 200 OK and either null or {}.

If you encounter any errors, see Error and Status Messages.

Deleting

Make a DELETE request to delete your profile photo.

Example

DELETE /v1/settings/profile/photo

A successful request returns the HTTP status code 200 OK.