photos.uploadContactProfilePhoto
Upload a custom profile picture for a contact, or suggest a new profile picture to a contact. The file, video and video_emoji_markup flags are mutually exclusive.
func (c *Client) PhotosUploadContactProfilePhoto(ctx context.Context, request *PhotosUploadContactProfilePhotoRequest) (*PhotosPhoto, error)
Calling this method
client.Run(ctx, func(ctx context.Context) error {
api := client.API()
res, err := api.PhotosUploadContactProfilePhoto(ctx, &tg.PhotosUploadContactProfilePhotoRequest{
// see Parameters
})
if err != nil {
return err
}
_ = res // *PhotosPhoto
return nil
})
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
Suggest | bool | — | If set, will send a messageActionSuggestProfilePhoto service message to user_id, suggesting them to use the specified profile picture; otherwise, will set a personal profile picture for the user (only visible to the current user). |
Save | bool | — | If set, removes a previously set personal profile picture (does not affect suggested profile pictures, to remove them simply delete the messageActionSuggestProfilePhoto service message with messages.deleteMessages). |
UserID | InputUserClass | yes | The contact |
File | InputFileClass | — | Profile photo |
Video | InputFileClass | — | Animated profile picture video |
VideoStartTs | float64 | — | Floating point UNIX timestamp in seconds, indicating the frame of the video/sticker that should be used as static preview; can only be used if video or video_emoji_markup is set. |
VideoEmojiMarkup | VideoSizeClass | — | Animated sticker profile picture, must contain either a videoSizeEmojiMarkup or a videoSizeStickerMarkup constructor. |
Returns
Possible errors
| Code | Type | Description |
|---|---|---|
| 400 | CONTACT_MISSING | The specified user is not a contact. |
| 400 | NEED_ACTION_MISSING | |
| 400 | USER_ID_INVALID | The provided user ID is invalid. |
References
- Official documentation
- Generated Go reference
- TL definition:
photos.uploadContactProfilePhoto#e14c4a71