AI Chatbot System
Build a real AI customer support chatbot for Maracade Technologies using n8n, OpenAI, WhatsApp Cloud API, and Google Sheets. This visual lab lesson teaches you how to automate replies, answer customers instantly, and build your first AI agent system.
Lesson Overview
What You Will Learn
Learn how to connect AI with WhatsApp and automate customer support replies using OpenAI and n8n workflows.
Tools Needed
n8n, OpenAI API key, Meta Developer Account, WhatsApp Cloud API, and Google Sheets.
Prerequisites
Basic computer knowledge and ability to use a browser. No coding experience required.
Final Outcome
A working AI chatbot that answers customers automatically through WhatsApp messages.
Prompt Engineering Guide
What Are Prompts?
Prompts are instructions you give to AI systems so they know how to behave and respond to users.
Why Prompts Matter
Better prompts create smarter AI replies, improve customer support quality, and reduce wrong answers.
Prompt Structure
A strong prompt contains role, rules, tone, product information, and response style instructions.
You are a professional AI support agent for Maracade Technologies. Rules: - answer politely - provide prices - explain payment methods - keep answers short - suggest next action
WhatsApp Cloud API Setup
π§Ύ Create Meta Developer Account
Visit Meta for Developers and create a developer account using your Facebook account. This allows you to access WhatsApp Cloud API services.
Buttons to click:
β’ Get Started
β’ Continue
β’ Verify Email
π± Create Facebook App
Inside Meta Developer Dashboard click βCreate Appβ and select βBusinessβ as the app type.
Required settings:
β’ App Name
β’ Contact Email
β’ Business Type
π¬ Enable WhatsApp Cloud API
Open your app dashboard and add the WhatsApp product from the products section.
π Generate Access Token
Open the API Setup page and copy the temporary access token generated by Meta.
π Copy Phone Number ID
Locate your WhatsApp Phone Number ID inside API setup settings and copy it.
π Connect Credentials Inside n8n
Inside n8n create credentials for OpenAI and HTTP Request authorization headers.
Meta Configuration Flow
Meta Developer
Main platform where you create apps and manage APIs.
Facebook App
Container that holds your WhatsApp Cloud API integration.
WhatsApp API
Service that sends and receives WhatsApp messages automatically.
Access Token
Secret authorization key used by n8n to connect with Meta servers.
n8n HTTP Request
Node that sends customer replies from AI directly into WhatsApp.
Customer Replies
Final automated messages delivered instantly to customers.
Step-by-Step Visual Lab
π Create Workflow
Open n8n dashboard and click βNew Workflowβ.
π Add Webhook Node
Add a Webhook node to receive WhatsApp messages from Meta.
/whatsapp-ai-webhook
π€ Add OpenAI Chat Node
Connect OpenAI Chat Model node after the webhook.
π Configure Credentials
Paste your OpenAI API key and Meta access token into n8n credentials.
π Feed AI With Product Data
Connect Google Sheets node so the AI can read products and prices.
π¨ Add HTTP Request Node
Use HTTP Request node to send messages back to WhatsApp customers.
β Configure WhatsApp Request
Add Meta API URL and Authorization header.
https://graph.facebook.com/v19.0/PHONE_NUMBER_ID/messages
π§ͺ Test Chatbot
Send a WhatsApp message to your test number and verify AI responses.
Code Lab Section
{
"messaging_product": "whatsapp",
"to": "25261XXXXXXX",
"type": "text",
"text": {
"body": "Hello π Smart Watch is available."
}
}
{
"role": "system",
"content": "You are an AI support agent for Maracade Technologies."
}
{
"from": "25261XXXXXXX",
"message": "Do you have Smart Watch?"
}
{
"product":"Smart Watch",
"price":"25",
"payment":"EVC Plus"
}
{
"headers": {
"Authorization": "Bearer YOUR_TOKEN"
}
}
Live Test Conversation
Workflow Structure
Webhook Trigger
Receives messages from WhatsApp customers.
OpenAI Chat Node
Processes customer questions using AI.
Google Sheets
Stores product names, prices, and payment methods.
IF Node
Checks conditions before sending replies.
WhatsApp API Node
Sends the final AI-generated reply to the customer.
Customer Reply
User receives automated support instantly.
Knowledge Check
1. What does the Webhook node do?
2. Why is the Access Token important?
3. Which node sends WhatsApp replies?
Common Errors & Fixes
β Invalid Token
Your access token expired or was copied incorrectly.
Fix:
β’ Generate new token
β’ Re-copy carefully
β’ Add Bearer before token
β Webhook Failure
Meta cannot reach your webhook URL.
Fix:
β’ Activate workflow
β’ Use public URL
β’ Verify webhook URL
β Wrong API URL
Incorrect Meta endpoint used.
Fix:
β’ Verify version number
β’ Use Phone Number ID
β OpenAI Credential Issue
OpenAI API key missing or invalid.
Fix:
β’ Re-add API key
β’ Test account balance
β WhatsApp Permission Error
Business verification or permissions missing.
Fix:
β’ Complete Meta verification
β’ Enable permissions
Lesson Complete
You completed Phase 1 of the AI Agent Rental Company course.
π Congratulations!
You successfully finished the AI Chatbot System lab lesson for Maracade Technologies.