Build a fully autonomous customer support agent that reads emails, queries your knowledge base, and drafts replies.
First, we need our agent to listen for incoming support requests. We will use n8n to connect to your Gmail or Zendesk.
Open n8n1. Log into your n8n workspace.
2. Add a new **Gmail Trigger** node or **Webhook** node.
3. Configure it to trigger on "Message Received".
4. Extract the `subject`, `sender`, and `body_text`.To prevent hallucinations, the agent needs context. We fetch related articles from a Vector Store.
Open Pinecone// Sample Python script to populate your Pinecone DB with FAQ data
import pinecone
from langchain.embeddings.openai import OpenAIEmbeddings
embeddings = OpenAIEmbeddings()
index = pinecone.Index("support-kb")
index.upsert(vectors=[
("faq-1", embeddings.embed_query("Refund policy: 30 days..."), {"category": "billing"}),
])Configure the AI node with a strict system prompt that enforces brand voice and restricts capabilities.
Open OpenAIYou are an empathetic, professional Customer Support Agent for [Your Company].
Your goal is to answer the customer's query using ONLY the provided context from our knowledge base.
Context: {{ $json.knowledge_base_results }}
Customer Email: {{ $json.body_text }}
Rules:
1. If the answer is not in the context, apologize and say a human agent will follow up.
2. Never promise refunds unless explicitly authorized by the context.
3. Keep the tone friendly and concise.Connect the output of the OpenAI node to an email sender or ticket updater.
Open Zendesk1. Add a **Zendesk Node** (or Gmail node).
2. Set the Action to "Update Ticket".
3. Map the AI's response to the Internal Note or Public Reply field.
4. Activate the workflow!