AI Conversational Sales & Support Agent (n8n + OpenAI)
Integrates with:
Overview
Unlock Dynamic Customer Interactions with this AI Agent
This AI Agent, 'Jovelino', acts as a sophisticated chatbot for your business, powered by OpenAI Assistants. It's engineered to understand user inquiries through natural language, provide personalized responses by initially processing lead data if available, retrieve real-time product or service details from your MySQL database, and consult external knowledge bases or APIs via HTTP requests. The agent maintains conversation context using a PostgreSQL-backed memory, ensuring seamless and intelligent interactions. Its core abilities include conversational AI, data retrieval, and tool utilization to handle sales inquiries, provide customer support, and guide users effectively.
Key Features & Benefits
- Intelligent Conversations: Leverages OpenAI Assistants for natural, context-aware dialogue, enhancing user engagement.
- Personalization Engine: Can process initial lead data to prime the AI's memory, enabling more tailored interactions from the start.
- Dynamic Data Access: Connects to MySQL databases using a dedicated tool to fetch up-to-date product/service information on demand during the conversation.
- External Knowledge Integration: Employs tools to query external APIs and knowledge bases, providing comprehensive answers beyond its core training.
- Persistent Chat Memory: Utilizes PostgreSQL to remember past interactions within a session, leading to more coherent and contextually relevant conversations.
- Extensible Toolset: The main OpenAI Assistant's capabilities are augmented with custom tools for database lookups and API calls, making it highly adaptable to specific business needs.
- Automated Lead Nurturing & Support: Frees up human agents by handling initial queries, qualifying leads, and providing 24/7 assistance.
Use Cases
- For B2C e-commerce: Instantly answer product questions about health insurance plans (or other products), guide users to relevant items based on stated needs (e.g., quotation type, city, age), and capture lead information naturally.
- For B2B SaaS: Act as a first-line sales development representative, qualifying leads by asking contextual questions, providing information about services, and potentially gathering details for follow-up.
- Automating initial customer support interactions, providing 24/7 responses to FAQs and common issues, reducing wait times.
- Gathering customer data, preferences, and feedback through natural conversation for later analysis and service improvement.
Prerequisites
- An n8n instance (Cloud or self-hosted).
- OpenAI API Key with access to assistant-compatible models (e.g., GPT-4, GPT-3.5 Turbo).
- Credentials for a PostgreSQL database (for chat memory storage).
- Credentials for a MySQL database (for product/data lookup).
- (Optional) URLs and any necessary authentication details for external APIs or knowledge bases used by the HTTP Request tools.
Setup Instructions
- Download the n8n workflow JSON file.
- Import the workflow into your n8n instance.
- Configure the 'Chat Trigger' node: Customize the
initialMessages
(e.g., greeting from 'Jovelino') as needed. - Configure the 'OpenAI' nodes (named 'OpenAI' and 'OpenAI2'):
- Select or create your OpenAI API credentials.
- The workflow uses specific Assistant IDs (
asst_numdCoMZPQ6GwfiJg5drg9hr
for initial lead data processing andasst_x2qfc7EuoPv7XGOL84ClEZ3L
for the main conversation). You will likely need to recreate these Assistants in your OpenAI account, defining their instructions, and enabling the necessary tools (e.g., for database queries, knowledge base access). Ensure the tool descriptions and functionalities match what the n8n workflow expects.
- Configure the 'Postgres Chat Memory' nodes ('Postgres Chat Memory' and 'Postgres Chat Memory1'):
- Select or create your PostgreSQL credentials.
- Ensure the
tableName
(e.g., 'aimessages') is appropriate. Note the differentcontextWindowLength
settings for initial data priming vs. ongoing conversation.
- Configure the 'Products in Daatabase' (MySQL Tool) node:
- Select or create your MySQL credentials.
- Review and adapt the SQL query to match your database schema and the parameters your OpenAI Assistant tool is configured to provide (e.g.,
{{ $fromAI("cityQuery") }}
).
- Configure the 'Knowledge Base' (HTTP Request Tool) node:
- Update the
url
and any required authentication. Customize thetoolDescription
to accurately reflect its purpose for the AI Assistant.
- Update the
- Configure the 'External API' (HTTP Request Tool) node:
- Update the
url
,method
,jsonBody
, and authentication as needed. Customize thetoolDescription
.
- Update the
- Review the 'If' node logic: This node routes the flow based on the presence of
leadData
. Ensure this aligns with how you plan to pass initial information (e.g., from a CRM or form) to the chat. - Review 'Edit Fields' nodes ('Edit Fields1', 'Edit Fields2'): These format the input for the AI. Adjust the templating if your input data structure or desired AI priming message differs.
- Test the workflow thoroughly by simulating conversations, including scenarios with and without initial
leadData
, and testing all integrated tools. - Activate the workflow.
Want your own unique AI agent?
Talk to us - we know how to build custom AI agents for your specific needs.
Schedule a Consultation