I've been trying for days, now I'm too frustrated...
This is just 1 part of a larger workflow I have to create. The goal is to extract data from emailed PDFs, then do stuff with the text, automating as much as possible.
I tried using Apps Script to detect when a label was applied in Gmail, then uploading the attachments to the GCS bucket. I couldn't make it work, no matter what configurations I tried. I restarted five times, but still screwed up somewhere.
Since I couldn't figure it out using Gmail, I scrapped the idea of going directly from Gmail to GCS and instead used the Apps Script to copy the attachments to Google Drive. Maybe I could make it work approaching it from GDrive rather than Gmail. Nope.
The Apps Script I made to detect new Drive files starts to work, then crashes when connecting to GCS. Same thing happened with Gmail.
I'm starting over again with a new GC project and bucket. I've enabled pretty much every API we thought might be needed or helpful.
I created a new Service Account and gave it the Roles: Document AI Admin, Service Account Token Creator, Storage Admin, Owner, etc.
Getting super frustrated, I basically just gave the SA permission to do everything.
None of it worked. Now it's Friday, time to go home, and I've got nothing good to tell the boss on Monday morning when he asks how it's going. I'd love some insight from anyone who's actually done this before. Or anyone who has an idea about how to pull text from emailed PDFs, better than using GC's Document AI tools.
Thanks folks.