Link Search Menu Expand Document

Method: photos.uploadContactProfilePhoto

Back to methods index

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.

Parameters:

NameTypeDescriptionRequired
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).Optional
saveBoolIf set, removes a previously set personal profile picture (does not affect suggested profile pictures, to remove them simply deleted the messageActionSuggestProfilePhoto service message with messages.deleteMessages).Optional
user_idUsername, chat ID, Update, Message or InputUserThe contactOptional
fileFile path or InputFileProfile photoOptional
videoFile path or InputFileAnimated profile picture videoOptional
video_start_tsdoubleFloating 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.Optional
video_emoji_markupVideoSizeAnimated sticker profile picture, must contain either a videoSizeEmojiMarkup or a videoSizeStickerMarkup constructor.Optional

Return type: photos.Photo

Can userbots use this method: YES

Can bots use this method: NO

MadelineProto Example (now async for huge speed and parallelism!):

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->start();

$photos_Photo = $MadelineProto->photos->uploadContactProfilePhoto(suggest: $Bool, save: $Bool, user_id: $InputUser, file: $InputFile, video: $InputFile, video_start_ts: $double, video_emoji_markup: $VideoSize, );