Back to all templates

Classify Gmail emails with OpenAI and forward them to the right team

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 for each department and selected in each "Add label" step
  • Department recipient email addresses, entered in each "Set value of recipient" step and as the default value in "Get value of recipient"
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

MoreAITemplates

Delegate questions to a remote agent over A2A from a tech lead agent

A chat agent that helps a team plan upgrades. For questions about Java or Spring versions, release dates or features, it delegates to a remote agent over the Agent2Agent protocol with the A2A Agent Tool, then combines the answer with its own advice. Built to call the Java release expert template, but works with any A2A agent.

TRIGGER:
New Chat Request
COMPONENTS:
+2

Serve a Java release expert agent to other agents over A2A

An AI agent that answers questions about Java and Spring release history: versions, release dates, headline features and migration notes. The workflow starts from a workflow call, so you can add it to a ByteChef A2A Server and other agents can delegate questions to it over the Agent2Agent protocol. Pair it with the Tech lead agent template.

TRIGGER:
New Workflow Call
COMPONENTS:

Plan a team offsite with an agent that asks before it plans

A chat agent with the Ask User Question tool. Before planning a team event, it asks three or four multiple-choice questions about budget, location, dates and activities. The run pauses until you answer in the chat, and then the agent writes a plan that fits your answers.

TRIGGER:
New Chat Request
COMPONENTS:
+2

Keep long chats short with history compaction and recall search

A chat agent with session-based Chat Memory v2. A small turn window keeps only the last few turns in the prompt and archives older ones, while conversation search lets the agent look up anything said earlier in the full log. A Claude Haiku model is attached for the Recursive summarization strategy, if you switch to it.

TRIGGER:
New Chat Request
COMPONENTS:
+1

Score CVs from Google Forms with OpenAI and sort them in Google Drive

When a Google Forms response is submitted, downloads the attached CV PDF from Google Drive, extracts its text, and summarizes it with AI. OpenAI scores the candidate from 0 to 10 against a Senior Java Developer job description. The name, email, summary, and score are recorded in a Google Sheet, and the CV file is filed into a Rejected or Potential candidates Google Drive folder based on the score.

TRIGGER:
A Google Forms is filled
COMPONENTS:
+3

Answer questions with a code interpreter agent that runs Python in Daytona

An AI agent that answers questions needing exact calculations by writing Python and running it in an isolated Daytona sandbox. Each tool call gets a fresh sandbox that is deleted after the run.

TRIGGER:
Manual
COMPONENTS:
+2

Load a folder of Markdown files into Pinecone for RAG

Lists all files in a local documentation directory recursively, then loops over each file, reads its contents, and loads it into a Pinecone vector database as a Markdown document, building a searchable knowledge base for retrieval-augmented generation.

TRIGGER:
Manual
COMPONENTS:

Generate a daily quote or joke with OpenAI and email it

This workflow prompts OpenAI for an inspirational quote on weekdays and a joke on the weekends. The quote is enriched with some context. Afterwards, the joke or the quote is sent via email.

TRIGGER:
Daily
COMPONENTS:
+1

Remember coding preferences across chats with long-term memory

A coding buddy for Java developers with the Auto Memory tool. When you state a lasting preference, such as your build tool or Java version, the agent saves it to memory, and in later conversations it reads its memory first and follows your preferences. Memory is kept per project deployment and environment, so it works in deployed runs only.

TRIGGER:
New Chat Request
COMPONENTS:
+2

Turn commit messages into release notes with an agent skill

A chat agent with the Skills Tool. When you paste commit messages, it loads the release-notes skill, runs the skill's script to group conventional commits by type, and writes short, user-facing release notes with new features, fixes and performance changes. The skill's SKILL.md and script are in a note on the canvas, ready to upload.

TRIGGER:
New Chat Request
COMPONENTS:
+2

Research and write answers with two subagents on different models

An orchestrator agent with the Task Tool and two subagents. A researcher subagent on Claude Haiku gathers facts as short bullets, and a writer subagent on Claude Sonnet turns them into a clear answer for Java developers. The orchestrator never answers research questions itself.

TRIGGER:
New Chat Request
COMPONENTS:
+2

Plan a Spring Boot 4 migration with an agent that keeps a todo list

A chat agent with the TodoWrite tool. For any request with three or more steps, such as migrating a service to Spring Boot 4, it first writes a todo list, keeps exactly one task in progress, and updates the list as it works through each step.

TRIGGER:
New Chat Request
COMPONENTS:
+2

Triage support tickets offline with Qwen3 on Ollama

Classifies a support ticket with Qwen3 8B running locally in Ollama, so the ticket text never leaves your network. A JSON schema constrains the answer to a category (Billing, Technical or Sales), a priority (Low, Medium or High) and a one-sentence summary that later steps can route on.

TRIGGER:
Manual
COMPONENTS:
See all templates

How ByteChef works?

Focus on what matters,automate the rest.

Copyright © ByteChef. All rights reserved.