Skip to main content

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

NameTypeRequiredDescription
SuggestboolIf 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).
SaveboolIf 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).
UserIDInputUserClassyesThe contact
FileInputFileClassProfile photo
VideoInputFileClassAnimated profile picture video
VideoStartTsfloat64Floating 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.
VideoEmojiMarkupVideoSizeClassAnimated sticker profile picture, must contain either a videoSizeEmojiMarkup or a videoSizeStickerMarkup constructor.

Returns

*PhotosPhoto

Possible errors

CodeTypeDescription
400CONTACT_MISSINGThe specified user is not a contact.
400NEED_ACTION_MISSING
400USER_ID_INVALIDThe provided user ID is invalid.

References