我如何不付費使用 AI API,以 n8n 建立自動回覆工作流程
I Built an Auto-Reply Workflow in n8n Without Paying for an AI API
作者以 n8n 建立表單觸發的自動回覆工作流程,透過 Ollama 在本機執行模型,無須支付 AI API 費用,並由 Gmail 寄出個人化確認電郵。模型草擬電郵後,工作流程會等待 10 秒才寄出;目前仍未加入電郵地址驗證、錯誤處理或人工審核。
A few days ago, I built my first n8n workflow: a manual trigger that sent an email through Gmail. It worked, but it was very basic.
For Day 6, I wanted to build something that feels closer to a real business use case.
The Idea
I imagined I'm running an AI solutions consulting business. Whenever someone wants help, the first step is filling out an onboarding form. I didn't want to send a confirmation email manually every single time, so I automated it.
The form is simple, with only three fields:
- First name
- Last name
- Email address
How the Workflow Works
On Form Submission → OpenAI Chat Model → Wait → Gmail
- On Form Submission: Instead of clicking a manual trigger, the workflow now starts on its own when someone submits the form.
- Chat model: It drafts a confirmation email using the person's details. The email thanks them, repeats their name and email so they can check it, and says I'll contact them soon to understand their problem.
- Wait (10 seconds): I added a short delay before sending. More on this below.
- Gmail: It sends the drafted email to the address the person entered in the form.
Problem 1: The AI API Needed Payment
When I set up the chat model, the API option I tried first required payment. For a practice exercise, I didn't want to spend money.
So I looked for an alternative and found Ollama, a tool that lets you run AI models locally on your own computer. I connected it to n8n using its OpenAI-compatible API by setting the base URL and choosing a compatible model [add the model you used here].
If you're a student practicing AI workflows, Ollama is worth trying. The only catch: your computer needs to be able to run the model you choose.
Problem 2: The Email Was Sent Instantly
During testing, the email went out the moment I clicked submit. I wanted a small gap between drafting and sending, so I added a Wait node set to 10 seconds between the chat model and Gmail.
What I Learned
- A trigger decides when a workflow starts. Switching from manual to form-based made it feel like a real process.
- Workflows are chains of small, simple steps. Each node does one job.
- You don't need a paid API to practice AI automation.
- Testing shows you things you didn't plan for, like the instant email.
What's Still Missing
This is a practice workflow, not a production one. It doesn't yet validate the email address, handle errors, or have a human check the AI-drafted email before it's sent. After my Day 3 lessons about AI making unverified claims, that last one is high on my list to fix.
The Result
The workflow worked end to end. Submitting the form triggered a personalized email that greeted the person by name, repeated their details for confirmation, and explained the next step.
It wasn't perfect, though:
- The line breaks are awkward, because the model added hard breaks mid-sentence
- A stray "---" appeared at the bottom
- It promises "our team will contact you shortly to arrange a meeting," which is exactly the kind of unverified commitment I wrote about in my last post. In a real business, I'd review or restrict that line before sending.
Tools used: n8n, Ollama, Gmail
Experiment: Automated client onboarding confirmation email
If you've built workflows in n8n, or found a free way to practice with AI models, what do you recommend?
ai #n8n #automation #LearningInPublic
來源:DEV Community · dev.to