twenty icon indicating copy to clipboard operation
twenty copied to clipboard

Fetch emails by threads

Open bosiraphael opened this issue 1 year ago • 0 comments

Scope & Context

For now, threads and messages are fetched separately.

  • First we fetch all the threads and save them in the database
  • Then we fetch all the messages and save them in the database and link them to threads

We instead want to fetch all threads then loop on the threads to get all the messages ids in the tread and fetch these messages by batches.

Note: The Gmail API allows us to get all messages in a thread with users.threads.get, but we want to be able to fetch only the messages which are not already in the database. We also want the raw mail to parse it with nodemailer mailparser, but users.threads.get only allows us to get the payload and not the raw mail. We will use users.threads.get with format minimal to only get the ids and labels.

Technical inputs

Modify fetch-workspace-messages.service.ts.

bosiraphael avatar Jan 02 '24 14:01 bosiraphael