School/Advanced Workflows/Automation Foundations
2/4
Wave 712 minintermediate

Connecting AI to Workflows

How to add AI processing steps to your automations.

Connecting AI to Workflows

This is where the magic happens: adding AI as a step in your automated workflows. Instead of just moving data between apps, your workflow now thinks. It reads an email and understands whether it is urgent. It scores a lead and decides which follow-up sequence to trigger. It summarizes a document and routes it to the right person.

Key Concept

There are five core AI workflow patterns -- Classify and Route, Enrich and Store, Generate and Review, Monitor and Alert, and Transform and Deliver. Every AI automation you will ever build is a variation of one of these five patterns. Learn them and you can design a workflow for any business process.

Method 1: Built-In AI Actions

Most automation platforms now have native AI capabilities:

Zapier AI Actions

Zapier has built-in AI steps you can drop into any Zap:

  • AI Text: Generate, summarize, classify, or transform text
  • AI Formatter: Clean and restructure data
  • AI Chatbot: Create a simple AI chatbot for your workflow

Example workflow:

  1. 1Trigger: New email in Gmail
  2. 2AI Text: "Classify this email as: sales inquiry, support request, spam, or other"
  3. 3Filter: IF classification = "sales inquiry"
  4. 4Action: Create a lead in HubSpot with the email content
  5. 5AI Text: "Draft a personalized response acknowledging their interest"
  6. 6Action: Create a draft reply in Gmail

Make AI Modules

Make offers AI modules and HTTP modules for connecting to AI APIs:

  • OpenAI module (ChatGPT, GPT-4)
  • HTTP module (connect to Claude API, any AI service)
  • Text aggregation and parsing modules

n8n AI Nodes

n8n has dedicated AI nodes:

  • AI Agent node (builds full agents with tools)
  • Chat Model nodes (Claude, GPT, Ollama for local models)
  • Memory nodes (for agent persistence)
  • Tool nodes (calculator, code, web search)

Method 2: API Integration

For more control, call AI APIs directly:

The Basic API Call Structure

Every AI API call follows this pattern:

  1. 1Endpoint: Where to send the request (e.g., https://api.anthropic.com/v1/messages)
  2. 2Authentication: Your API key in the headers
  3. 3Model: Which AI model to use
  4. 4System prompt: Instructions for this specific task
  5. 5User message: The data you want processed
  6. 6Parameters: Temperature, max tokens, etc.

Cost Management

Watch Out

API calls cost money, and costs can spiral quickly if you are not careful. A workflow that processes 1,000 items per day using GPT-4 can cost hundreds of dollars per month. Use cheaper models for simple tasks and reserve expensive models for complex reasoning.

API calls cost money. Be smart:

  • Use cheaper models (Claude Haiku, GPT-3.5) for simple tasks like classification
  • Use powerful models (Claude Sonnet/Opus, GPT-4) only for complex reasoning
  • Set max_tokens to limit response length (and cost)
  • Cache repeated queries when possible

Common AI Workflow Patterns

Pattern 1: Classify and Route

Trigger → AI classifies the input → Route to different paths based on classification

Use case: Email triage, support ticket routing, lead scoring

Pattern 2: Enrich and Store

Trigger → AI enriches the data with analysis/summary → Store in database/CRM

Use case: Adding AI analysis to form submissions, enriching customer profiles

Pattern 3: Generate and Review

Trigger → AI generates content → Human reviews → Publish/send

Use case: Social media posts, email drafts, report generation

Pattern 4: Monitor and Alert

Scheduled trigger → AI analyzes data → IF concerning → Send alert

Use case: Brand monitoring, KPI anomaly detection, competitor tracking

Pattern 5: Transform and Deliver

Trigger → AI transforms data into a new format → Deliver to destination

Use case: Meeting notes to action items, raw data to report, feedback to insights

Your First AI Workflow

Here's a simple workflow you can build in any platform:

The "Smart Email Digest"

  1. 1Trigger: Every day at 6 PM
  2. 2Action: Get all unread emails from today
  3. 3AI Step: "For each email, provide: sender, subject, one-sentence summary, and urgency (low/medium/high)"
  4. 4AI Step: "Organize these into a daily digest, with high-urgency items first"
  5. 5Action: Send the digest to yourself via Slack or email

This takes 10 minutes to build and saves you 20+ minutes of email scanning every day.

Try It

Build the Smart Email Digest workflow this week. It is the simplest AI automation with the most immediate payoff. You will use it every single day, and it will prove to you (and your team) that AI automation actually works.

Exercises

0/3
Prompt Challenge+20 XP

Design a "Classify and Route" workflow for your business. Define: the trigger (what incoming data?), the AI classification categories (at least 4), and the action for each category. Be specific about which tools you would connect.

Hint: Example: incoming support emails classified as billing/technical/feature-request/complaint, each routed to a different team or Slack channel with AI-generated summary.

Quiz+5 XP

Why should you use cheaper AI models (like Claude Haiku) for simple classification tasks?

Quiz+5 XP

In the "Generate and Review" pattern, why is the human review step important?