New to Kestra?
Use blueprints to kickstart your first workflows.
Classify inbound support emails with AI, enrich contracts in DuckDB, and route actions across Slack channels via Kestra multi-branch switch.
Customer operations and support teams are routinely overwhelmed by inbound shared inboxes (support@, contact@, help@). High-stakes production outage reports from tier-1 enterprise accounts get mixed with routine billing inquiries, expansion leads, and unsolicited vendor sales pitches. When critical incidents sit unassigned in queue backlogs, response SLAs are breached and enterprise customer churn accelerates.
This blueprint implements an intelligent, automated Tier-1 triage gate. Incoming emails are first enriched against customer account contracts using in-memory DuckDB to extract ARR and contract tier. Next, Kestra's AI plugin evaluates the issue urgency and customer sentiment with strict JSON Schema constraints, generating an executive summary and drafted resolution reply. Finally, io.kestra.plugin.core.flow.Switch routes the ticket to the exact operational channel (Engineering Incident On-Call, Sales Revenue Ops, or Finance Billing) while silently filtering out marketing noise.
enrich_customer_profile (io.kestra.plugin.jdbc.duckdb.Query): Performs an in-memory SQL lookup joining the sender domain against contract tables to retrieve customer_tier, contract_arr, and sla_target.classify_support_email (io.kestra.plugin.ai.agent.AIAgent): Evaluates the email body and customer context using Google Gemini with strict JSON Schema enforcement, classifying category (TECHNICAL_OUTAGE, SALES_OPPORTUNITY, BILLING_DISPUTE, SPAM), urgency, and generating an empathetic draft reply.route_by_category (io.kestra.plugin.core.flow.Switch): Evaluates the structured category verdict and dispatches targeted actions:TECHNICAL_OUTAGE: Dispatches an emergency P1 incident card to the engineering team.SALES_OPPORTUNITY: Delivers qualified lead intelligence to revenue operations.BILLING_DISPUTE: Forwards invoice adjustments and draft responses to finance operations.defaults: Logs and silences low-priority marketing spam without channel clutter.alert_triage_failure (errors block): Catches downstream connectivity failures or unhandled exceptions and notifies the on-call channel.pluginDefaults keeping Slack webhook URLs out of individual task blocks.Building email triage with point-to-point automation tools (Zapier, Make) creates brittle, opaque pipelines that lack centralized secrets governance, version control, and relational data enrichment. Orchestrating with Kestra provides native in-memory DuckDB queries, declarative JSON Schema enforcement with foundational AI models, multi-branch conditional routing, and complete execution audit trails in a single maintainable YAML workflow.
sender_email for enterprise contract lookups, preventing malicious third parties from spoofing VIP domains to trigger high-priority alerts.gemini-2.5-flash.GEMINI_API_KEY: API key for Gemini foundational model execution.SLACK_WEBHOOK_URL: Slack webhook endpoint for alert delivery.WEBHOOK_KEY: Authentication secret for event-driven webhook execution.GEMINI_API_KEY and SLACK_WEBHOOK_URL to your Kestra namespace secrets.webhook_inbound_email trigger.This blueprint has been created by sheikhlimon
