Save attachment picture Telegram bot in Drive

Hi,
this template makes exactly what I want, but for some reason when a picture is uploaded on GDrive it’s converted to 1kb picture. It only happens when I upload a picture, not a pdf.

:camera_flash: Relevant screenshots
This is my customization:

Any idea?

Thanks.

The scenario looks pretty good. Need to investigate the output of the Download a file module. Can you share a snippet of it.

1 Like

Hi Manish,
the first screenshot I share with you is already the “Download a File” module. Let me know if it’s what you are asking for.

Hi Manish, any idea?. You are my last option.
I found out that If I send an image as document the file is upload without problems.

Thanks.

Let’s connect over a call to investigate this further.

Book a slot here: Calendly - Manish Jain

Great to see how ready you are to help out the community members @ManishMandot.

When you find the solution, can you circle back here and give us a summary so that we can all learn? Thanks!

Hi, I wait for 20 minutes but nobody appear.
I share with you the input/output bundles and see if it helps.

Telegram WatchUpdates Output

[
{
“message”: {
“message_id”: 43,
“from”: {
“id”: 600038765,
“is_bot”: false,
“first_name”: “Guillermo”,
“last_name”: “Cano”,
“language_code”: “en”
},
“chat”: {
“id”: 600038765,
“first_name”: “Guillermo”,
“last_name”: “Cano”,
“type”: “private”
},
“date”: “2023-02-24T09:04:44.000Z”,
“photo”: [
{
“file_id”: “AgACAgQAAxkBAAMrY_h9rCWj9AyZ92bVUAgjW9jgwskAAqK4MRviRMhTXglQl5dhVEgBAAMCAANzAAMuBA”,
“file_unique_id”: “AQADorgxG-JEyFN4”,
“file_size”: 1033,
“width”: 63,
“height”: 90,
“type”: “Photo”
},
{
“file_id”: “AgACAgQAAxkBAAMrY_h9rCWj9AyZ92bVUAgjW9jgwskAAqK4MRviRMhTXglQl5dhVEgBAAMCAANtAAMuBA”,
“file_unique_id”: “AQADorgxG-JEyFNy”,
“file_size”: 17866,
“width”: 224,
“height”: 320
},
{
“file_id”: “AgACAgQAAxkBAAMrY_h9rCWj9AyZ92bVUAgjW9jgwskAAqK4MRviRMhTXglQl5dhVEgBAAMCAAN4AAMuBA”,
“file_unique_id”: “AQADorgxG-JEyFN9”,
“file_size”: 74004,
“width”: 561,
“height”: 800
},
{
“file_id”: “AgACAgQAAxkBAAMrY_h9rCWj9AyZ92bVUAgjW9jgwskAAqK4MRviRMhTXglQl5dhVEgBAAMCAAN5AAMuBA”,
“file_unique_id”: “AQADorgxG-JEyFN-”,
“file_size”: 129818,
“width”: 897,
“height”: 1280
}
],
“attachment”: {
“file_id”: “AgACAgQAAxkBAAMrY_h9rCWj9AyZ92bVUAgjW9jgwskAAqK4MRviRMhTXglQl5dhVEgBAAMCAANzAAMuBA”,
“file_unique_id”: “AQADorgxG-JEyFN4”,
“file_size”: 1033,
“width”: 63,
“height”: 90,
“type”: “Photo”
}
},
“update_id”: 484246859,
“channel_post”: null,
“inline_query”: null,
“callback_query”: null,
“edited_message”: null,
“edited_channel_post”: null
}
]


Telegram Dwonload A File Input

[
{
“fileId”: “AgACAgQAAxkBAAMrY_h9rCWj9AyZ92bVUAgjW9jgwskAAqK4MRviRMhTXglQl5dhVEgBAAMCAANzAAMuBA”
}
]


Telegram Dwonload Output

[
{
“fileName”: “file_31.jpg”,
“filePath”: “photos/file_31.jpg”,
“fileOutput”: “IMTBuffer(1033, binary, 5c2c97e335fa5b2b582da2cdc85b7ba1d841fd7a): ffd8ffe000104a46494600010101004800480000ffdb0043000e0a0b0d0b090e0d0c0d100f0e11162417161414162c20211a24342e3736332e32323a4153463a3d4e3e32324862494e56585d5e5d3845666d655a6c535b5d59ffdb0043010f1010161316”
}
]


Google Drive Upload A File Input

[
{
“data”: “IMTBuffer(1033, binary, 5c2c97e335fa5b2b582da2cdc85b7ba1d841fd7a): ffd8ffe000104a46494600010101004800480000ffdb0043000e0a0b0d0b090e0d0c0d100f0e11162417161414162c20211a24342e3736332e32323a4153463a3d4e3e32324862494e56585d5e5d3845666d655a6c535b5d59ffdb0043010f1010161316”,
“select”: “value”,
“convert”: false,
“filename”: “file_31.jpg”,
“folderId”: “/1bdZUVnh8PZX_OYhSEJC9TjwtaWr9saBl”,
“destination”: “drive”
}
]


Google Drive Upload a File Output

[
{
“kind”: “drive#file”,
“id”: “1uFbNwfTXwQpdHU4h0_ViQ9y14zlErk_K”,
“name”: “file_31.jpg”,
“mimeType”: “image/jpeg”,
“starred”: false,
“trashed”: false,
“explicitlyTrashed”: false,
“parents”: [
“1bdZUVnh8PZX_OYhSEJC9TjwtaWr9saBl”
],
“spaces”: [
“drive”
],
“version”: “3”,
“webContentLink”: “https://drive.google.com/uc?id=1uFbNwfTXwQpdHU4h0_ViQ9y14zlErk_K&export=download”,
“webViewLink”: “https://drive.google.com/file/d/1uFbNwfTXwQpdHU4h0_ViQ9y14zlErk_K/view?usp=drivesdk”,
“iconLink”: “https://drive-thirdparty.googleusercontent.com/16/type/image/jpeg”,
“hasThumbnail”: true,
“thumbnailLink”: “https://lh6.googleusercontent.com/0-Xwyfs1AdgiXVc4vfI6GVQyeWenHQFgKSHThyuU6v0RnKpKGNM89SSqoHVlq07eZtgyvfRC5PHPZDM=s220”,
“thumbnailVersion”: “1”,
“viewedByMe”: false,
“createdTime”: “2023-02-24T09:04:44.861Z”,
“modifiedTime”: “2023-02-24T09:04:46.097Z”,
“modifiedByMeTime”: “2023-02-24T09:04:46.097Z”,
“modifiedByMe”: true,
“owners”: [
{
“kind”: “drive#user”,
“displayName”: “Guillermo Cano”,
“photoLink”: “https://lh3.googleusercontent.com/a/default-user=s64”,
“me”: true,
“permissionId”: “17221203010910916497”,
“emailAddress”: “@@@@@@@@”
}
],
“lastModifyingUser”: {
“kind”: “drive#user”,
“displayName”: “Guillermo Cano”,
“photoLink”: “https://lh3.googleusercontent.com/a/default-user=s64”,
“me”: true,
“permissionId”: “17221203010910916497”,
“emailAddress”: “@@@@@@@@”
},
“shared”: false,
“ownedByMe”: true,
“capabilities”: {
“canAcceptOwnership”: false,
“canAddChildren”: false,
“canAddMyDriveParent”: false,
“canChangeCopyRequiresWriterPermission”: true,
“canChangeSecurityUpdateEnabled”: false,
“canChangeViewersCanCopyContent”: true,
“canComment”: true,
“canCopy”: true,
“canDelete”: true,
“canDownload”: true,
“canEdit”: true,
“canListChildren”: false,
“canModifyContent”: true,
“canModifyContentRestriction”: true,
“canModifyLabels”: false,
“canMoveChildrenWithinDrive”: false,
“canMoveItemIntoTeamDrive”: true,
“canMoveItemOutOfDrive”: true,
“canMoveItemWithinDrive”: true,
“canReadLabels”: false,
“canReadRevisions”: true,
“canRemoveChildren”: false,
“canRemoveMyDriveParent”: true,
“canRename”: true,
“canShare”: true,
“canTrash”: true,
“canUntrash”: true
},
“viewersCanCopyContent”: true,
“copyRequiresWriterPermission”: false,
“writersCanShare”: true,
“permissions”: [
{
“kind”: “drive#permission”,
“id”: “17221203010910916497”,
“type”: “user”,
“emailAddress”: “@@@@@@@@”,
“role”: “owner”,
“displayName”: “Guillermo Cano”,
“photoLink”: “https://lh3.googleusercontent.com/a/default-user=s64”,
“deleted”: false,
“pendingOwner”: false
}
],
“permissionIds”: [
“17221203010910916497”
],
“originalFilename”: “file_31.jpg”,
“fullFileExtension”: “jpg”,
“fileExtension”: “jpg”,
“md5Checksum”: “b6b6f8672cf63b7ee97299fec6294482”,
“sha1Checksum”: “5c2c97e335fa5b2b582da2cdc85b7ba1d841fd7a”,
“sha256Checksum”: “3462818e1dad4b6eccdc9d871dac4ca3cbb6478ceea0911689ef7915f9e70b66”,
“size”: “1033”,
“quotaBytesUsed”: “1033”,
“headRevisionId”: “0B_B3hmCZiXRVU1MycjZqa0U4bExoYnFQaW8yS2svVWh2SldFPQ”,
“imageMediaMetadata”: {
“width”: 63,
“height”: 90,
“rotation”: 0
},
“isAppAuthorized”: true,
“linkShareMetadata”: {
“securityUpdateEligible”: false,
“securityUpdateEnabled”: true
}
}
]

Thanks.

I am not using Google Drive, i am using Evernote but i have the same issue.
The dowloaded file is always a small image not the source. Even for a PDF, it is an image.
Looks like it is downloading thumbnails instead of the real file.

Thanks

Hi @Guillermo

Is this issue resolved?

If you need assistance, don’t hesitate to contact me.

Best Regards,

Msquare Automation
:point_right: Visit our website | :spiral_calendar: Book a free consult

Hi @Mohamed_Jahar ,
no unfortunatly I haven’t been able to make it work.
I have still same problem, as @pemen says the uploaded picture is just a thumbnail.

Thanks.

Hi @Guillermo

Please use the Telegram module “Download a File” to get the photo data. Here in the module, you need to input the File ID of the photo. Since the photo array contains multiple file IDs of different quality, we need to map the last File ID among them. To get the total length of the array (last file ID), we should use the length() function.

If you need assistance, don’t hesitate to contact me.

Best Regards,

Msquare Automation
:point_right: Visit our website | :spiral_calendar: Book a free consult

4 Likes

Hi,
Thanks for your proposal.
I go the error:

BundleValidationError

Validation failed for 1 parameter(s).

  • Missing value of required parameter ‘fileId’.

Seems like i have nothing in Channel but Message.
So finally it works for me using:

thanks

Hi Mohamed_Jahar,

how do you manage the case when it can be a photo or an attachement ?
do we have to test all cases and setup a router to split between photo and file attachment ?

thanks for your answer

it works with a router that covers all cases

Yes this is important and needs to be done with filtering and router