Layer 220
PhotosUploadContactProfilePhoto
Upload a custom profile picture for a contact, or suggest a new profile picture to a contact.
method
Users
Parameters
| Name | Type | Description |
|---|---|---|
| Flags | # | Flags, see TL conditional fields |
| Suggest | flags.3?true | If set, will send a message Action Suggest Profile Photo 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 | flags.4?true | If set, removes a previously set personal profile picture (does not affect suggested profile pictures, to remove them simply delete the message Action Suggest Profile Photo service message with messages. delete Messages ). |
| UserId | InputUser | The contact |
| File | flags.0?InputFile | Profile photo |
| Video | flags.1?InputFile | Animated profile picture video |
| VideoStartTs | flags.2?double | 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 | flags.5?VideoSize | Animated sticker profile picture, must contain either a video Size Emoji Markup or a video Size Sticker Markup constructor. |
Returns
photos.PhotoPossible Errors
| Code | Type | Description |
|---|---|---|
| 400 | CONTACT_MISSING | The specified user is not a contact. |
| 400 | USER_ID_INVALID | The provided user ID is invalid. |
Gogram Example
// PhotosUploadContactProfilePhoto - using Params struct result, err := client.PhotosUploadContactProfilePhoto(&tg.PhotosUploadContactProfilePhotoParams{ UserId: &tg.InputUserSelf{}, // Optional fields: // Suggest: true, // Save: true, // File: &tg.InputFile{ID: int64(0), Parts: 1, Name: "file.dat"}, // Video: &tg.InputFile{ID: int64(0), Parts: 1, Name: "file.dat"}, // ... }) if err != nil { // handle error } // result is *tg.PhotosPhoto