HELP: Automating Gmail Classification with ChatGPT and Draft Creation

HELP: Automating Gmail Classification with ChatGPT and Draft Creation

Hi everyone,

I’m working on automating Gmail with ChatGPT to classify emails into three categories:

  1. Invoices: Emails containing receipts, payment confirmations, or invoices.
  2. Needs Reply: Emails that require a response, such as questions or requests for additional information.
  3. Automated Emails: Routine updates, newsletters, or irrelevant system notifications.

Since I don’t know how to code, I’m relying on ChatGPT for assistance. However, I’ve encountered a few issues:

  1. Classification Accuracy: The model sometimes misclassifies emails, leading to incorrect categorization.
  2. Draft Format: When generating drafts, the email content is returned as JSON instead of clean, plain text.

Currently, I’m using 8 prompts (4 user prompts and 4 system prompts) to classify emails, generate responses, extract information, and finalize the results. Here’s the best result I’ve managed so far:

Example Output:

SUBJECT:  
"RE: ```plaintext Classification: Needs Reply Response: [THE TEXT WRITTEN AS A RESPONSE]   ```"  

or

"```plaintext Classification: Needs Reply Response: [THE TEXT WRITTEN AS A RESPONSE]! ```"  

My Questions:

  1. How can I improve the classification accuracy for better results?
  2. Is there a way to ensure the draft content is formatted as clean, plain text instead of JSON?
  3. Do you know of any guides or tutorials for setting up a project like this?

Any advice, tips, or resources would be greatly appreciated! Thank you!


This updated version incorporates your request while keeping the post clear and concise.

@Shay_Ai

  1. How can I improve the classification accuracy for better results?

It may be difficult if you do not provide prompts that you are inputting. Also, the AI is not perfect, so you would need to allow for errors to be included.

  1. Is there a way to ensure the draft content is formatted as clean, plain text instead of JSON?

It may be possible to format the draft text using Text Parser’s Match Patter or Replace modules.

  1. Do you know of any guides or tutorials for setting up a project like this?

For a general tips on AI prompts, see the following links. And, check out the make Community, where you can find a number of them under ‘Email Draft’.
https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-the-openai-api

Hi,
Thanks for that! :blush:

Regarding point 2, could you clarify what you mean? I’m trying to ensure that in one result, I get both the classification (e.g., “Receipt” or “Needs Reply”) and the content of the draft written in ChatGPT.

By the way, is there a way to make GPT create more than one message (in the content) within a single bundle? I’d prefer a solution that doesn’t involve adding more models, so it won’t double the credits used.

Thanks!

Regarding No.2, aren’t you talking about extracting JSON as plain text?
Are you talking about creating multiple drafts in a single ChatGPT run?

By the way, is there a way to make GPT create more than one message (in the content) within a single bundle? I’d prefer a solution that doesn’t involve adding more models, so it won’t double the credits used.
Does it work if you specify to create multiple messages in System Prompt?