Back to all templates

AI Email Classifier

Classify incoming Gmail messages with AI and route them to the right team.

Description:

Polls Gmail for new emails and uses OpenAI to classify each one into a single department label (Sales, Support, Finance, Operations, HR, or URGENT). The matching Gmail label is applied, the department's recipient address is stored, and the original email is forwarded to the correct team.

Key Features:
  • AI classification constrained to a fixed set of labels via a JSON response schema
  • Multi-way branch routing, one case per department label
  • Automatic Gmail label tagging of the incoming message
  • Per-team recipient address resolved through in-execution data storage
  • HTML email forwarding to the resolved team address
Prerequisites:
  • Google Mail (Gmail) connection
  • OpenAI API key
  • Gmail labels pre-created, matching the label IDs referenced in the workflow
  • Department recipient email addresses
Ideal For:

Support and operations teams that want incoming email triaged and routed to the correct department automatically.

STEPS
  1. Trigger: poll Gmail for a new email.
  2. Classify the email into a single label (Sales, Support, Finance, Operations, HR, or URGENT) with OpenAI.
  3. Branch on the predicted label: add the matching Gmail label and store the team's recipient address.
  4. Read the stored recipient address, defaulting to a fallback inbox.
  5. Forward the original email to the resolved team address.
COMPONENTS
Google Mail
Open Ai
Data Storage
CATEGORYAI

How ByteChef works?

Focus on what matters,
automate the rest.

ByteChef