F
Flowman docsWorkflow SDK
Back to app
Workflow step actions

classifyEmails

Classifies mailbox emails with AI in batches and returns normalized structured rows. The recruiting-source helper groups those rows into contacts with role, organization, confidence, evidence counts, sample subjects, and notes.

Default labels

The built-in recruiting classifier uses recruiting_agency, recruiter, direct_applicant, referral, job_board, internal, and irrelevant.

Usage

typescript
import {
  aggregateRecruitingSources,
  classifyEmails,
} from "@/workflows/shared/actions/email-classifier";

const { classifications } = await classifyEmails({
  record,
  stepKey: "classifyRecruitingSources",
  emails,
  instructions: "Find candidate sourcing contacts and recruiting agencies.",
});

const contacts = aggregateRecruitingSources({ emails, classifications });