Make.com AI Agent Tutorial

📝 Blog⏱ 7 min read

Make.com AI Agent Tutorial

Make.com (formerly Integromat) is a powerful visual automation platform that excels at building AI agents through its scenario-based workflow builder. Unlike Zapier's linear zaps, Make's canvas-based approach makes it ideal for complex AI agents with branching, loops, and state management. This tutorial walks you through building your first AI agent in Make.com.

What You'll Build

A complete AI agent that: 1. Receives messages via webhook or chat 2. Processes them with an LLM (OpenAI, Anthropic, etc.) 3. Uses tools to take actions (CRM, email, database, etc.) 4. Maintains memory across conversations 4. Handles errors gracefully with retries and fallbacks

Prerequisites

Architecture Overview

User Message (Webhook/Chat)
       +
OpenAI Module (Chat Completion)
       +
Tools Router (Router + HTTP/API modules)
       +
Memory (Data Store / Variables)
       +
Response Formatter
       +
Webhook Response / Chat Reply

Step 1: Set Up OpenAI Connection

1. Add OpenAI Connection

1. In Make.com, go to Connections > Add Connection 2. Search OpenAI > Select OpenAI 3. Enter your API Key from OpenAI Platform 4. Name it "OpenAI" > Save

2. Test Connection

Create a test scenario: 1. OpenAI > Create Chat Completion 2. Model: gpt-4o-mini 3. Messages: [{"role": "user", "content": "Hello"}] 4. Run once > Verify response

Step 2: Build Your First AI Agent

Scenario Structure

Webhook (Trigger)
    +
OpenAI - Create Chat Completion (Agent Brain)
    +
Router (Intent Classification)
    +-- Tool: Web Search
    +-- Tool: Database Query
    +-- Tool: Send Email
    +-- Tool: Create CRM Record
    +-- Default: General Response
    +
Memory Update (Data Store)
    +
Response Formatter
    +
Webhook Response

Step-by-Step Build

#### 1. Create Webhook Trigger

1. New Scenario > Webhooks > Custom Webhook 2. Click Add > Name: "AI Agent Webhook" 3. Copy webhook URL for testing 4. Data Structure: Add fields: message (text), sessionId (text), userId (text)

#### 2. Add OpenAI Chat Completion

1. Add OpenAI > Create Chat Completion 2. Connection: Select your OpenAI connection 3. Model: gpt-4o-mini (or gpt-4o for complex reasoning) 4. Messages: Map from webhook: ``json [ {"role": "system", "content": "You are a helpful AI assistant. You have access to tools: web_search, database_query, send_email, create_crm_record. Use tools when needed. Always respond in JSON format with 'action' and 'parameters' fields."}, {"role": "user", "content": "{{1.message}}"} `` 4. Max Tokens: 2000 5. Temperature: 0.1 6. Response Format: JSON Object

#### 3. Add Router for Tool Selection

1. Add Flow Control > Router 2. Connect OpenAI output to Router 3. Add routes for each tool:

Route 1: Web Search - Filter: {{contains(toLower(2.choices[0].message.content), "web_search")}} - Modules: HTTP > Make a request (SerpAPI, Brave Search, etc.)

Route 2: Database Query - Filter: {{contains(toLower(2.choices[0].message.content), "database_query")}} - Modules: Database > Execute Query (PostgreSQL, MySQL, Airtable)

Route 3: Send Email - Filter: {{contains(toLower(2.choices[0].message.content), "send_email")}} - Modules: Gmail/Outlook > Send Email

Route 4: Create CRM Record - Filter: {{contains(toLower(2.choices[0].message.content), "create_crm_record")}} - Modules: HubSpot/Pipedrive > Create Contact/Deal

Route 5: Default (General Chat) - Filter: {{true}} (fallback) - Modules: Set Variable > Format response

#### 4. Add Memory with Data Store

1. Data Stores > Add Data Store > Name: "Agent Memory" 2. Structure: - sessionId (Text, Primary Key) - userId (Text) - history (Text/JSON) - updatedAt (Date) 3. Add Data Store > Search Record module: - Data Store: Agent Memory - Key: sessionId from webhook 4. Add Data Store > Update Record module: - Append new messages to history array - Keep last 10-20 messages

#### 5. Format Response

1. Tools > JSON > Create JSON 2. Structure: ``json { "response": "{{Router output}}", "sessionId": "{{1.sessionId}}", "timestamp": "{{now}}", "toolsUsed": ["web_search"] } ``

#### 6. Webhook Response

1. Webhooks > Webhook Response 2. Status: 200 3. Headers: Content-Type: application/json 3. Body: Map from JSON module

Step 3: Add Error Handling

1. Enable Retry on Modules

For each critical module (OpenAI, HTTP, Database): 1. Click module > Settings (gear icon) 2. Advanced Settings > Retry on error 3. Attempts: 3 3. Delay: 5 seconds (exponential backoff)

2. Add Error Handler Route

1. Right-click Router > Add Error Handler 2. Connect to Error Handler route 3. Add modules: - Slack > Send Message (alert team) - Email > Send Email (alert admin) - Set Variable > Fallback response 4. Connect to Webhook Response with fallback message

3. Add Rate Limit Handling

1. Error Handler route > Add Filter 2. Condition: {{contains(lower(error.message), "rate limit")}} 3. Yes branch: Sleep (60s) > Resume (repeat failed module) 4. No branch: Continue to alert/fallback

Step 4: Add Conversation Memory

Using Data Store for Conversation History

1. Data Store > Search Record (at start) - Key: {{1.sessionId}} - If found: Retrieve history array 2. OpenAI Module > Messages: ``json [ {"role": "system", "content": "..."}, ...{{if(1.history.length > 0, 1.history, [])}}, {"role": "user", "content": "{{1.message}}"} ` 3. Data Store > Update Record (at end) - Key: {{1.sessionId}} - Data: history: {{add(1.history, [{"role": "user", "content": "{{1.message}}"}, {"role": "assistant", "content": "{{OpenAI.response}}"]})}} - Keep last 20 messages: {{slice(history, -20)}}`

Step 5: Test Your Agent

Test via Webhook

1. Copy webhook URL from Webhook module 2. Use Postman/cURL: ``bash curl -X POST "https://hook.eu1.make.com/your-webhook-url" -H "Content-Type: application/json" -d '{"message": "What is the weather in New York?", "sessionId": "test-123", "userId": "user-456"}' ``

2. Check execution log for: - Webhook received - OpenAI response - Tool execution (if any) - Memory update - Response sent

Test Conversation Flow

# Follow-up (should remember context) curl -X POST "..." -d '{"message": "When will it ship?", "sessionId": "conv-001"}' ```

Step 6: Deploy as Chat Widget (Optional)

Make.com Chat Widget

1. Settings > Chat Widget > Enable 2. Configure: - Scenario: Select your agent scenario - Welcome Message: "Hi! How can I help?" - Theme: Light/Dark - Position: Bottom right 2. Embed Code: ``html ``

Advanced: Multi-Agent Orchestration

For complex workflows, chain multiple AI agents:

Main Agent (Router)
    +
Agent 1: Researcher (Web Search + Summarize)
    +
Agent 2: Writer (Draft Content)
    +
Agent 3: Reviewer (Edit + Polish)
    +
Final Output

Implementation: 1. Main Agent classifies intent, routes to specialist agents 2. Execute Scenario module calls sub-scenarios 3. Aggregator combines results 4. Final Agent formats final response

Cost Optimization

OptimizationSavings
Use `gpt-4o-mini` for classification10x cheaper than GPT-4o
Cache frequent queries (Data Store)Reduce LLM calls 50%+
Batch operations (Batch API)50% token cost reduction
Limit `max_tokens` per callPrevent runaway costs
Use `temperature: 0` for deterministic tasksConsistent, cheaper

Monitoring & Debugging

Execution Log 1. **Scenarios** > **Execution Log** 2. Filter by scenario > Click any run 3. Click module > **Input/Output** panels

Debug Panel 1. Scenario Editor > **Run Once** 2. Click each module > **Input/Output** 3. For OpenAI: check **Prompt**, **Response**, **Tokens**

Key Metrics to Monitor - **Execution time** (target < 30s) - **Error rate** (target < 2%) - **Token usage** (cost tracking) - **Error types** (rate limit, timeout, validation)

Common Issues & Fixes

IssueFix
OpenAI returns invalid JSONUse **Response Format: JSON Object** in OpenAI module
Memory not persistingCheck Data Store key mapping, verify Update Record runs
Tools not calledCheck Router filters, ensure OpenAI returns valid tool calls
Rate limitedAdd Sleep module, reduce concurrency, use backoff
Memory lost between runsVerify Data Store key = sessionId, check Update Record

Production Checklist

Related Tutorials

Frequently Asked Questions

Yes. Make.com's visual scenario builder lets you create AI agents by connecting modules like OpenAI Chat Completion, HTTP requests, Data Stores, and Routers. No coding required, though you can add JavaScript in Code modules for advanced logic.

Use Make's Data Stores. Create a Data Store with sessionId as key and a history array. At the start of each run, search for the sessionId to retrieve history. At the end, update the record with the new conversation turn. Keep last 10-20 messages to manage token costs.

Yes. Use the Router module to classify the AI's intent, then route to appropriate modules: HTTP Request for web search APIs, Database modules for queries, CRM modules for record creation, etc. The AI Agent (OpenAI module) outputs tool calls that the Router routes.

Make charges per operation (module run), Zapier charges per task. For AI agents with multiple steps per conversation, Make is typically 30-50% cheaper at scale. Make Pro ($29/mo) includes 40K operations vs Zapier Pro ($49/mo) with 2,000 tasks.

Yes. Make.com has a built-in Chat Widget feature. Enable it in Settings > Chat Widget, select your agent scenario, customize appearance, and embed the provided JavaScript snippet on your website.

Advertisement

Related Articles