Build a Voice AI Phone Agent
Build an AI phone agent that takes dessert orders and emails results.
Introduction
30 Second Summary
Restaurants get slammed with phone calls during peak hours. Every missed call is a missed order, and every hold time is a frustrated customer.
In this project, you will build a voice AI phone agent for Demetres, a Toronto dessert restaurant. Your agent answers a real phone number, takes dessert orders through natural conversation, and emails you a formatted order summary within seconds of each call ending.
What You'll Build
Picture this: you call a phone number, chat naturally about waffles and ice cream flavours, hang up, and check your inbox to find a perfectly formatted order waiting for you.
By the end of this project, you'll have:
- A voice AI agent that answers a real phone number, greets callers as Demetres, and takes dessert orders through natural conversation.
- An automated email pipeline that delivers structured order details (customer name, items, pickup time) to your inbox within seconds of each call.
- A reusable system prompt pattern for building conversational ordering agents in any domain.
- Secret Mission: Add upselling logic so the agent suggests complementary items and reads back the full order before submitting.
Are there any prerequisites?
None. This guide walks you through setting up every tool from scratch. All you need is a Google account and about 50 minutes.
Before We Start
Before We Start...
Before we dive in, let's lock in what you're about to build and why it matters. Think about what problem a voice ordering agent solves for a busy dessert restaurant like Demetres that gets flooded with phone calls during peak hours.
Set Up Vapi and n8n Accounts
Your voice AI agent needs two platforms to work. Vapi handles the voice conversation and phone number. n8n handles the automation that delivers order emails to your inbox.
In this step, you will create accounts on both platforms and generate a Gmail app password so n8n can send emails on your behalf.
In this step, get ready to:
- Create a Vapi account with $10 in free credits.
- Create an n8n Cloud account with a 14-day free trial.
- Generate a Gmail app password for n8n to send order emails.
Create a Vapi account
Vapi is the voice AI platform that powers your phone agent. Signing up gives you $10 in free credits, which covers roughly 60 minutes of test calls.
- Open your browser and go to dashboard.vapi.ai.
- Click Sign Up.
- Enter your email and create a password, or click Google to sign up with your Google account.
- After signing up, you land on the Vapi Dashboard.
- Confirm you can see a credit balance showing $10.00 in the dashboard. This appears in the billing or overview area.
Why $10 in free credits?
Vapi charges $0.05 per minute as a platform fee, plus provider costs for the AI model and voice. Your $10 covers approximately 60 minutes of test calls, which is far more than you need for this project.
Dashboard showing a blank screen?
Try refreshing the page or signing out and back in. If the issue persists, try a different browser or clear your cache.
help me fix a blank Vapi dashboard after signing up
Create an n8n Cloud account
n8n is the workflow automation tool that receives your order data and sends the email. The Cloud version gives you a publicly accessible webhook URL out of the box.
- Open a new browser tab and go to n8n.io.
- Click Start free trial on the homepage.
- Sign up with your Google account for the fastest setup.
- After signing in, you land on the n8n Cloud workspace with an empty workflow canvas.
What does the free trial include?
You get a 14-day Pro trial with 1000 workflow executions. No credit card is required. This project uses fewer than 20 executions total, so you have plenty of room.
Can't find the free trial button?
Look for a Get started free or Start free trial button on the n8n.io homepage. The wording may vary slightly. Choose the option that does not ask for a credit card.
help me find and start the n8n Cloud free trial
Enable Gmail app password for n8n
n8n needs a way to send emails from your Gmail account. Google does not allow third-party tools to use your regular password directly. Instead, you generate a special 16-character app password that grants n8n permission to send on your behalf.
What is an app password?
An app password is a one-time 16-character code that lets a specific app access your Google account without your main password. It requires 2-Step Verification to be enabled first. You can revoke it at any time from your Google Account settings.
- Open a new tab and go to myaccount.google.com.
- In the left sidebar, click Security.
- Under the How you sign in to Google section, click 2-Step Verification.
- If 2-Step Verification is not already enabled, follow the prompts to turn it on. You will need your phone to confirm.
Once 2-Step Verification is active, you can create the app password.
- Navigate directly to myaccount.google.com/apppasswords in your browser.
- You may be asked to re-enter your Google password.
- In the App name field, type n8n credential.
- Click Create.
- Google displays a 16-character password in four groups of four. Copy this password immediately and save it somewhere safe (a notes app or password manager).
This password is shown only once
Once you close the dialog, you cannot retrieve this password again. If you lose it, you will need to generate a new one from the same page. Save it now before clicking Done.
Don't see the App Passwords page?
The App Passwords option only appears after 2-Step Verification is enabled. Make sure you completed the 2-Step Verification setup first, then try the direct URL again.
If you use a Google Workspace (school or work) account, your administrator may have disabled app passwords. Use a personal Gmail account instead.
help me access Google App Passwords for my Gmail account
All three accounts are now ready. You have Vapi with $10 in credits, n8n Cloud with an empty canvas, and a Gmail app password saved for later.
Your platforms are locked and loaded. Next up, you will create the Demetres voice assistant and hear it greet you for the first time.
Create the Demetres Voice Assistant
Your accounts are ready and your tools are in place. Now it is time to build something you can actually talk to.
In this step, you will create a voice AI assistant that greets callers as Demetres and takes dessert orders conversationally. You will be able to speak with it in your browser within minutes. The catch? The order has nowhere to go once the call ends.
In this step, get ready to:
- Create and configure the Demetres Order Agent in Vapi with a full system prompt.
- Test the assistant using the browser-based voice call feature.
Create the assistant with the Demetres system prompt
A system prompt is the instruction set that tells your AI how to behave, what it knows, and how to respond. You will give the Demetres agent a full personality, menu knowledge, and ordering rules.
- In the Vapi dashboard, click Assistants in the left sidebar.
- Click Create Assistant.
- Select Blank Template.
- Name the assistant Demetres Order Agent.
- Set the First Message by pasting this text into the field:
Hi there! Thanks for calling Demetres. I can help you place an order for pickup. What can I get for you today?
What is the first message?
This is the opening line the AI speaks the moment someone connects to the call. It sets the tone and immediately tells the caller what the agent can do.
- Scroll down to the System Prompt field. Paste the first half of the system prompt by copying this:
# Demetres - AI Order Taking Agent
## Identity and Purpose
You are Demetres' friendly order-taking assistant. You help customers place dessert orders for pickup over the phone. Do not introduce yourself after the first message.
## Menu Knowledge
Demetres is a dessert restaurant. Categories available:
- Belgian Waffles (light and fluffy, served with ice cream and toppings)
- Liege Waffles (dense, caramelized, rich)
- French Crepes (thin, delicate, served with ice cream and toppings)
- Cakes (fudge cakes, cheesecakes, red velvet)
- Parfaits and Sundaes (layered ice cream with sauces, fruits, toppings)
- Ice Cream (artisanal flavours including Cocoa Chanel, Dulce and Banana, Mango Sorbetto, White Chocolate Silk)
- Milkshakes (classic and specialty flavours)
- Hot Drinks (cappuccino, latte, chai, matcha, hot chocolate)
- Iced Coffees (espresso-based with ingredients like Nutella, caramel)
What does this section do?
The Identity and Purpose section tells the AI who it is and what it does. It also prevents the agent from awkwardly re-introducing itself after the first message.
The Menu Knowledge section gives the agent the full Demetres menu so it can answer questions about available items, flavours, and categories.
- Directly below what you just pasted (still in the same System Prompt field), add the second half of the prompt:
## Ordering Rules
- Each waffle, crepe, or sundae comes with a choice of ice cream flavour and up to 3 toppings
- Available toppings include: Belgian chocolate sauce, fresh fruit, whipped cream, icing sugar, brownie pieces, streusel, mini marshmallows, caramel sauce, nuts
- Always confirm: customer name, full order contents, and desired pickup time
- If a customer asks about something not on the menu, politely let them know Demetres specializes in desserts
## Conversation Flow
1. Greet and ask what they would like to order
2. Take the order item by item, asking about flavour/topping choices
3. When the customer is done ordering, confirm: customer name, complete order, pickup time
4. Once confirmed, use the recordOrder tool to submit the order
5. Thank the customer and end the call
## Style
- Warm, friendly, conversational
- Keep responses concise (under 40 words per turn)
- One question at a time
- Repeat order details clearly during confirmation
What do these sections do?
Ordering Rules defines guardrails: what comes with each item, how many toppings are allowed, and what to always confirm before finishing.
Conversation Flow gives the agent a step-by-step script for how to run the call. It mentions recordOrder as a tool to call at the end, which you will create in the next step.
Style keeps responses short and warm. One question at a time prevents the AI from overwhelming callers.
✔️ Awesome, I've got everything!
Make sure both halves are in the System Prompt field with no gap or extra characters between them.
ⓧ I'd like to double check the full code
Scroll through your System Prompt field and confirm these sections appear in order:
- # Demetres - AI Order Taking Agent (title)
- ## Identity and Purpose (2 lines about who it is)
- ## Menu Knowledge (9 menu categories listed)
- ## Ordering Rules (4 bullet rules)
- ## Conversation Flow (5 numbered steps)
- ## Style (4 bullet points about tone)
- Click Publish to save your assistant.
You should see Demetres Order Agent appear in your Assistants list with a published status.
Don't see the Publish button?
Make sure you are not still inside the template selection screen. You should be on the assistant configuration page with the First Message and System Prompt fields visible.
If your system prompt has a red error indicator, check for stray characters or accidental deletions at the beginning or end of the pasted text.
help me troubleshoot my Vapi assistant not saving
Test the assistant with the browser
Your assistant is published and ready to talk. The Talk to Assistant feature lets you have a live voice conversation directly in your browser without needing a phone number.
- Click the Talk to Assistant button in the Vapi dashboard.
- Your browser will ask for microphone permission. Click Allow to let the assistant hear you.
What should I order?
Try ordering a Belgian waffle with Cocoa Chanel ice cream and chocolate sauce. Give your name and a pickup time like 6:30 PM when the agent asks. This exercises the full conversation flow.
Before you finish the order and hang up, think about this: what do you expect happens to the order information after the call ends?
- Complete the full ordering conversation with the agent. Confirm your name, items, and pickup time when asked.
- End the call by clicking the hang-up button.
The agent greeted you, took your order conversationally, and confirmed the details. But when the call ended, the order vanished into thin air.
There is no tool connected to actually record or send the order anywhere. The system prompt references recordOrder, but that tool does not exist yet.
Can't hear the assistant or it can't hear you?
Make sure you granted microphone permission when your browser prompted you. If you accidentally denied it, click the lock icon in your browser's address bar, set Microphone to Allow, and reload the page.
If you hear the assistant but it does not respond to you, check that your system microphone input is set to the correct device in your OS sound settings.
help me fix microphone issues with Vapi Talk to Assistant
You now have an AI agent that can hold a natural dessert-ordering conversation. Next up, you will give it hands by creating a tool that captures the order data and sends it somewhere useful.
Add the Order Recording Tool
Your Demetres assistant can hold a natural conversation and take an order. But when the call ends, the order vanishes into thin air.
In this step, you will give the assistant the ability to act on what it hears. A function tool lets the AI structure the messy voice data into clean JSON and send it somewhere. You will create a tool called recordOrder, attach it to the assistant, and test the whole flow.
In this step, get ready to:
- Create the recordOrder function tool with three required parameters.
- Attach the tool to the Demetres Order Agent assistant.
- Test the tool call and observe it in the Vapi call logs.
Create the recordOrder tool in Vapi
Right now the assistant knows it should call a tool named recordOrder (its system prompt says so), but that tool does not exist yet. You need to create it in the Vapi dashboard so the AI has something to call.
- In the Vapi Dashboard, click Tools in the left sidebar.
- Click Create Tool.
- Select Function as the tool type.
- Set the tool name to recordOrder.
- Set the description to: Record a confirmed customer order. Call this only after the customer has confirmed their name, order contents, and pickup time.
What is a function tool?
A function tool is a way to give an AI assistant "hands." When the LLM decides the conversation has reached a point where action is needed, it calls the tool with structured arguments. The tool then sends that data to an external server via a webhook.
The description you wrote tells the AI exactly when to fire the tool. Without a clear description, the AI might call it too early (before confirming the order) or not at all.
Now add the three parameters that define what data the tool captures:
- Scroll down to the Parameters section.
- Add the first parameter: name customerName, type string, description The customer's full name, required checked.
- Add the second parameter: name orderContents, type string, description Complete list of items ordered with flavours and toppings, required checked.
- Add the third parameter: name pickupTime, type string, description Requested pickup time, required checked.
- Leave the Server URL field blank. You will configure this in a later step.
- Click Save.
You should see recordOrder listed in your Tools page with three parameters.
Don't see your tool saved?
- Make sure you clicked Save at the bottom of the tool form. Unsaved changes are lost if you navigate away.
- Check that all three parameters have the required checkbox enabled. Vapi may not save a tool with incomplete parameter configuration.
Help me figure out why my Vapi tool isn't saving.
Attach the tool to the assistant
The tool exists, but your assistant does not know about it yet. You need to connect them.
- Click Assistants in the left sidebar.
- Select Demetres Order Agent.
- Scroll down to the Tools section and expand it.
- Click Add Tool and select recordOrder from the dropdown.
- Click Publish to save your changes.
You should see recordOrder listed under the Tools section of your assistant.
Tool not appearing in the dropdown?
- Make sure you saved the tool in the previous substep. Only saved tools appear in the assistant's tool dropdown.
- Try refreshing the page. The dropdown pulls from your saved tools list.
Help me attach my recordOrder tool to my Vapi assistant.
Test the tool call
Time to see if the assistant actually calls the tool when you complete an order. You will have a full conversation, confirm your order details, and then check the call logs to see what happened behind the scenes.
- Click the Talk to Assistant button in the dashboard.
- Order a Belgian waffle with Cocoa Chanel ice cream and chocolate sauce.
- When the assistant asks, give your name and a pickup time like 6:30 PM.
- Confirm the order when the assistant reads it back to you.
- End the call after the assistant thanks you.
Before you check the logs, predict: do you think the tool call succeeded or failed? Why?
- Click Calls in the left sidebar.
- Click the most recent call in the list to open its details.
- Look through the call transcript and logs for the tool call entry.
You will see the recordOrder tool call with structured JSON containing your customerName, orderContents, and pickupTime. The tool call status shows as failed. That failure is expected and intentional.
Why does the tool call fail?
The tool fired correctly and the AI structured your voice order into clean JSON. But you left the Server URL blank, so Vapi has nowhere to send that data. The order gets captured, structured, and then dropped on the floor.
This is exactly the gap you will close in the next step by building an n8n webhook to receive the order and email it to you.
Your assistant now has hands. It can structure a voice order into clean, machine-readable data. Next up, you will build the destination server that catches that data and turns it into an email in your inbox.
Build the Email Pipeline in n8n
Your Vapi agent can take dessert orders conversationally and structure the data into clean JSON. But that data vanishes the moment the call ends.
This step creates the destination: a webhook endpoint in n8n that catches every order and fires off a formatted email to your inbox within seconds. Once connected, the full loop closes.
In this step, get ready to:
- Create a webhook workflow that listens for incoming order data.
- Configure a Gmail node to send formatted order emails.
- Connect everything and test end-to-end with a real phone call.
Create the webhook workflow in n8n
A webhook is a URL that waits for incoming data. When Vapi's recordOrder tool fires, it will POST the order JSON to this URL, which triggers your n8n workflow.
- In your n8n Cloud workspace, click Add workflow.
- The canvas opens. Click the + button to add a node.
- Search for Webhook and add the Webhook trigger node.
- In the node configuration panel, set HTTP Method to POST.
- Set Path to demetres-order.
- At the top of the node panel, click Production URL to toggle to the production URL view.
- Copy the Production URL displayed and paste it somewhere safe (a text file or sticky note). You will need this shortly.
You should see a URL that looks like https://your-workspace.app.n8n.cloud/webhook/demetres-order.
Why two URLs?
n8n generates a Test URL and a Production URL for every Webhook node. The Test URL only works for 120 seconds while you're debugging. The Production URL works permanently once the workflow is published.
Add the Send Email (Gmail) node
Now you need a node that takes the incoming order data and formats it into an email. The Send Email node connects to Gmail via SMTP using the app password you created in Step 1.
- Click the + button after the Webhook node to add a second node.
- Search for Send Email and add it.
- Click on the credential dropdown and select Create New Credential.
- Fill in the credential fields:
- Click Save to store the credential.
Credential test failing?
Double-check that you pasted the 16-character app password (no spaces) and not your regular Gmail password. The host must be exactly smtp.gmail.com with port 465.
If you still see an error, confirm that 2-Step Verification is enabled on your Google Account. App passwords only work when 2-Step Verification is active.
Help me fix my n8n Gmail credential.
Now configure the email itself so n8n knows what to send when an order arrives.
- In the To field, enter your Gmail address (you are the restaurant owner receiving orders).
- In the Subject field, enter:
New Demetres Order from {{ $json.body.message.customerName }}
- Set Email Type to HTML.
- Paste the following into the Message body field:
<h2>New Order - Demetres</h2>
<p><strong>Customer:</strong> {{ $json.body.message.customerName }}</p>
<p><strong>Order:</strong> {{ $json.body.message.orderContents }}</p>
<p><strong>Pickup Time:</strong> {{ $json.body.message.pickupTime }}</p>
<p><em>Order received via AI phone agent</em></p>
What do those curly-brace expressions do?
The {{ $json.body.message.fieldName }} syntax is how n8n pulls values from incoming webhook data. When Vapi calls the recordOrder tool, it POSTs JSON with the three parameters you defined (customerName, orderContents, pickupTime). These expressions slot each value into the right place in your email.
- Scroll down to Send Options and turn off Append n8n attribution.
- Close the node panel.
Your workflow now has two connected nodes: Webhook (receives order data) into Send Email (formats and sends the order to your inbox).
Activate, connect to Vapi, and test end-to-end
Your workflow is built but not live yet. Publishing makes the Production URL active so external services can trigger it.
- Click the Publish button in the n8n canvas header (or press Shift+P).
- In the publishing modal, click Publish to make the workflow live.
Your workflow is now active. The Production URL you copied earlier will trigger this workflow whenever it receives a POST request.
Next, connect Vapi to this URL so the agent knows where to send orders.
- Switch back to the Vapi Dashboard.
- Click Tools in the left sidebar.
- Select the recordOrder tool.
- Paste your n8n Production webhook URL into the Server URL field.
- Click Save.
What is the Server URL?
The Server URL is the endpoint Vapi calls when the AI assistant invokes a function tool. By setting it to your n8n webhook, every time the assistant calls recordOrder, the order data flows directly into your email workflow.
Now assign a phone number so you can call the agent from your real phone.
- Click Phone Numbers in the left sidebar.
- Click Create Phone Number.
- Stay on the Free Vapi Number tab.
- Enter a US area code (for example 212 or 646). Only US numbers can be created for free.
- Under Inbound Settings, find the Assistant dropdown and select Demetres Order Agent.
- Changes save automatically. Note the phone number displayed.
Number activation delay
It takes a couple of minutes for a new Vapi number to fully activate. If your first call goes straight to silence, wait two minutes and try again.
Before you test, think about what you expect to happen. You will call the phone number, have a conversation with the AI, confirm your order, and then check your email.
Do you think the email will arrive? What should the subject line say?
- Call the phone number from your phone.
- Place a full order: give your name, order a dessert with customizations, and provide a pickup time.
- Confirm the order when the agent reads it back to you.
- Hang up and check your email inbox.
You should receive a formatted email within seconds. The subject line reads New Demetres Order from [your name] and the body contains your order details and pickup time.
No email arrived?
Check these common causes:
- Make sure you published the n8n workflow (the Publish button should show no pending changes). The Production URL only works after publishing.
- Verify the Server URL in the Vapi recordOrder tool matches your n8n Production URL exactly (no trailing spaces).
- Check your spam folder. Emails sent via SMTP app passwords sometimes land there.
- In n8n, click the Executions tab to see if the workflow received data. If no execution appears, the webhook URL was not called.
Help me debug my Vapi to n8n email pipeline.
The full loop is closed. Your voice goes in, structured order data comes out as an email. Next up, you will add upselling and order confirmation to make this agent even more professional.
Secret mission
Add Upselling and Order Confirmation
A real restaurant agent does not just take orders passively. It suggests complementary items to increase revenue and reads back the complete order to prevent mistakes. Can you transform your agent from a basic order-taker into a revenue-generating tool?
Clean Up Your Resources
Clean Up Your Resources
Decide whether to keep your resources running, pause them to come back later, or delete them entirely. This project uses Vapi free credits and an n8n Cloud free trial, so there are no ongoing subscription costs. However, any calls to your phone number will consume Vapi credits at approximately $0.05 per minute.
Cost warning
Your Vapi phone number is live and publicly callable. Each incoming call consumes your free credit balance at $0.05/min platform cost plus provider costs. If you do not plan to continue testing, deactivate or delete the number to preserve your remaining credits.
Resources you used:
- Vapi phone number (free Vapi number with US area code).
- Vapi assistant (Demetres Order Agent with recordOrder tool).
- n8n Cloud workflow (Demetres Order Email, active with webhook trigger and Gmail node).
- Gmail app password (named n8n credential, grants n8n access to your Gmail).
Keep everything running
No action needed. Choose this if you are still actively testing or want to demo the agent to others.
- Your phone number stays callable and orders continue to email you as long as your n8n trial is active and Vapi credit remains.
- Your n8n Cloud trial lasts 14 days from sign-up. After the trial expires, the workspace is deleted automatically.
- Your Gmail app password persists until you revoke it manually.
Pause - I'll come back to this later
Shut down the email pipeline to stop credit usage from accidental calls. Your configuration stays intact so you can reactivate later.
- In n8n Cloud, open your workflow and toggle the Active switch to off. The webhook URL stops responding, so even if someone calls, no email fires.
- The Vapi phone number still answers calls, but the tool call will fail silently because n8n is no longer listening. No credits are consumed beyond the call itself.
- When you are ready to resume, toggle the n8n workflow back on. Everything reconnects automatically.
Delete - I don't want to use this again
Remove all project resources completely. Follow each step below to clean up.
- In the Vapi Dashboard, click Phone Numbers in the left sidebar. Find your Demetres phone number and click the delete icon next to it to remove it.
- Click Assistants in the left sidebar. Select Demetres Order Agent and delete it.
- Click Tools in the left sidebar. Find recordOrder and delete it.
- In n8n Cloud, open your Demetres Order Email workflow. Click the three-dot menu and select Delete to remove it.
- In your Google Account, go to your App Passwords page (search "App passwords" in your Google Account security settings). Find the entry named n8n credential and click Remove to revoke it. Once revoked, n8n can no longer access your Gmail.
That's a Wrap!
That's a Wrap!
Nice work! You just built a fully functional voice AI phone agent for Demetres that takes dessert orders over a real phone call and delivers formatted order summaries to your inbox.
You've learned how to:
- Built a voice AI agent with a crafted system prompt that gives it menu knowledge, ordering rules, and natural conversational flow over a real phone number.
- Created a function tool (recordOrder) that structures unstructured voice data into clean JSON with customer name, order contents, and pickup time.
- Connected the voice agent to an automated email pipeline using webhooks and n8n workflow automation.
- (Secret Mission) Added upselling logic and an explicit order confirmation protocol to create a more professional, revenue-generating agent.
Ready to quiz yourself?