Hi all. I’d like to know how to get an attachment from a Gmail email message. My current flow tries using a custom Gmail API call to GET it and the data is returned as a base64 string in the body.data element.
Next I do a hack-y check if it’s a PDF by checking if the base64 string starts with “JVBERi0” which decodes to “%PDF-”.
Now I’m at the point of trying to upload the attachment to Google Drive. In the Upload file piece, the File input helper text states “The file URL or base64 to upload”. So I passed in the base64 string. This doesn’t work and I get the error:
{
"file": [
"Expected file url or base64 with mimeType, but found value: JVBERi0..."
]
}
I’ve tried to pass in the mimeType along with it without success. Can anyone help me to get the file to upload? In any way at all, I’m not fixated on my strategy.
Since you are using a custom API to get attachments, how do you obtain the message ID? If you are using Gmail as the trigger, it has an attachments field that can be used directly in the Google Drive step.
I will run this flow monthly and calculate the time ago using a Code piece. I use this value in a custom API call to get all emails received in that period (one month, in my flow). This returns the emails’ message IDs.
I’m disappointed with the lack of help in this community. It seems you almost always end up finding the answer yourself after days or weeks in my case.