Auto-answer support emails with Cloudflare Web Search + n8n
When a customer emails a question — "Does your plan include X?" or "How do I do Y?" — someone has to stop what they're doing and look it up. If the answer lives on a public page or in recent docs, a workflow (an automated chain of steps) can find it instantly. The snag: until now, giving a workflow live web access required stitching together separate search-tool subscriptions. Cloudflare's new Web Search API — launched 2 October 2026 — adds that live search in one call, billed through the same AI Gateway (Cloudflare's control panel for AI requests) you already use.
Create a Cloudflare API token with AI Gateway permissions
A Cloudflare API token is a password-like key that lets outside tools (like n8n) talk to Cloudflare on your behalf. You need one with permission to call the Web Search API, which runs through AI Gateway. Log in to dash.cloudflare.com, click your avatar (top-right) → My Profile → API Tokens → Create Token → Create Custom Token. Under Permissions, add Account → AI Gateway → Edit. Click Continue to summary → Create Token. Copy the token value — it's shown only once.
Note your Cloudflare Account ID
The Web Search API endpoint URL contains your Account ID — a unique string that identifies your Cloudflare account. You'll find it in the right-hand sidebar of almost any page in the Cloudflare dashboard, under the heading Account ID. Copy it — you'll paste it into n8n in a moment.
Set up the Gmail Trigger in n8n
In n8n (your automation canvas), a trigger node is the starting block that wakes the workflow up. The Gmail Trigger watches your inbox and fires every time a new email arrives. Open n8n, click + Add workflow in the Workflows tab, then click the big + on the empty canvas to add the first node. Search for Gmail Trigger, select it, then connect your Google account when prompted. Set Event to Message Received and optionally filter to a specific label (like 'support') so you're not processing every email.
Call the Cloudflare Web Search API from an HTTP Request node
Now you add the node that actually searches the web. An HTTP Request node in n8n lets you call any web API — you just fill in the address and credentials. Click the + button to the right of the Gmail Trigger node, search for HTTP Request, and select it. Set Method to POST. In the URL field, enter `https://api.cloudflare.com/client/v4/accounts/YOUR_ACCOUNT_ID/ai/websearch/` (replace YOUR_ACCOUNT_ID). Under Authentication, choose Header Auth, set the header name to `Authorization` and the value to `Bearer YOUR_TOKEN`. In the Body section, choose JSON and paste the body below — the `{{ $json.text }}` part automatically pulls the email text from the previous step.
Draft a reply with Claude using the search results
You now have up to five web results — each with a title, URL, and short description. The next node sends those results plus the original question to the Claude API (Anthropic's AI, which n8n has a built-in node for) and asks it to write a helpful, sourced reply. Click + after the HTTP Request node, search for Anthropic, and select Message. Connect your Anthropic API key. In the User Message field, write a prompt (instruction to the AI) that includes the email text and the search results. Use n8n's `{{ }}` expressions to wire both in dynamically.
Send the draft reply via Gmail
The last node sends the drafted reply back to the customer — or, if you prefer to review first, saves it as a Gmail draft (a saved but unsent email) so you can check it before hitting send. Click +, search for Gmail, and select it. Set Resource to Message and Operation to either Send (auto-sends) or Create Draft (safer to start with). Map the To field to the sender's address from the trigger, and the Message field to the text Claude produced.
What you get
Every new support email triggers a live web search via Cloudflare's Web Search API, passes the results to Claude, and produces a sourced draft reply — all waiting in your Gmail Drafts folder for a quick review before you hit send. You keep control; the workflow does the legwork. Rough effort: ~2 hours. Free tiers: n8n Cloud trial, Cloudflare free account. Costs when live: Cloudflare Web Search API from $0.25/1,000 searches (Ceramic.ai list price, no markup); Claude Sonnet 5.5 API at standard Anthropic rates. A low-volume support inbox stays near zero..
NowGTM at Claimlane
Latest postLatest from the blog