Build guide

How to Build a Fully Automated AI Voice Agent (n8n + Vapi)

A Vapi voice agent that collects lead info on every call and pipes it into a Google Sheet through n8n.

Vapin8nGoogle Sheets
Nov 17, 2025
Optimized for

What you'll build

A Vapi voice agent that answers the phone, collects the caller's lead info (name, business, phone, email, what they're inquiring about, scheduling preference), and pipes the whole thing into a Google Sheet - automatically, on every call. A call comes in after 5 p.m. while you're at dinner, your assistant picks up, tracks down all the information, and the row is sitting in your sheet by the time the call ends. In the demo, the lead landed in the sheet live, seconds after hanging up.

The flow: Vapi takes the call → a custom tool fires at the end of the call and sends the transcript to an n8n webhook → n8n extracts, parses, and cleans the data → Google Sheets gets a new row.

What you'll need

Step 1: Create the assistant in Vapi

Create a new assistant and connect it to GPT-4o cluster. It's considered the best standard conversational model - I'd recommend it over 5.1, which is also going to be super expensive. Definitely a lot more.

Set the first message to something simple:

Hi, thanks for calling [your business]. Can I get your name and business name?

Step 2: Write the system prompt - in markdown format

The full system prompt is linked below - feel free to copy it. You don't need all of it; it's just very specific on purpose. The more specific you are, the less going back and forth with the client.

One thing that IS essential: write the whole prompt in markdown format - hashtags for headers, bolding, bullet points. That's how the model reads your instructions clearly. The hashtags define what's most important, what's context, what's less important. Same reason you'd rather read bullet points than a wall of paragraph - the model understands it better too.

What's in the prompt:

Step 3: Create the custom tool that sends the lead to n8n

In Vapi, under Assistants → Tools, hit Create a tool → custom tool. Name it whatever you want - mine is "send lead to n8n" - with a description saying it sends the complete lead data including the full call transcript, caller name, phone number, business name, etc.

Here's the part that matters: none of those properties are actually necessary except one. Click Add property, type in transcript, and mark it required - or else it's sometimes going to miss it. You don't even need a description on it.

Then - key thing people miss - go back to your assistant, scroll down to the Tools section, and attach the tool to the assistant. If you skip this, the agent won't know the tool exists.

Step 4: Create the n8n webhook and wire it to the tool

In n8n, start a workflow with a Webhook node. Copy the production URL and paste it into the tool's server URL field back in Vapi.

That's the whole connection. From now on, if your system prompt is right, every call ends with the tool firing and all the call-log info landing in n8n.

Step 5: Extract the transcript with a code node

When the data first hits the webhook, it's a mess - the transcript is buried in a pile of JSON you'd need two minutes to even find. Add a Code node that pulls out just the transcript, so what comes out the other side is purely the conversation text. (Code linked below, or have ChatGPT write it.)

Step 6: Parse the transcript into clean fields with an LLM node

Now turn that raw conversation into structured data: name = Austin, business = AI Waterside, and so on. Add a ChatGPT node with this prompt:

You are a data extraction assistant. Given a phone call transcript between
a caller and an AI receptionist, extract the caller's details and intent
as a single valid JSON object in the exact format below.

Why JSON? JavaScript Object Notation is the format these automation platforms respond to best. The LLM reads the transcript, figures out "this is where the caller said my name is Austin," and maps every field.

Step 7: Clean the JSON with a second code node

The LLM output is still dirty - it wraps the JSON in extra junk. I tried killing that in the prompt itself and it wasn't working well, so the fix is a second Code node that cleans, validates, and normalizes the JSON. Execute the step and you get exactly what you need: name, business, phone, email, inquiry, scheduling, timestamp. (Again - copy mine from the link below, or have GPT write your own and plug it in.)

Step 8: Append the row to Google Sheets

Add a Google Sheets node → Append row in sheet. Connect your sheet, then just drag and drop each parsed field into its column. Execute - bang, new row. From here it runs continuously without your help.

Step 9: Respond to the webhook so Vapi knows it worked

Last node: a webhook response that just tells Vapi "we received the data."

If you skip this node, the Vapi agent sometimes errors out - it doesn't understand the data was sent and reports that the tool call failed. One simple node saying "success, thanks for the transcript" fixes it.

That's it. Not the most technical explanation, but it works - a voice agent that collects lead information and adds it to a Google Sheet, or any data tracker really.

Resources

← Back to the library Good luck and happy building