AI Movie Recommendation Agent with MongoDB & OpenAI
Integrates with:
Overview
Unlock Intelligent Movie Discovery and Curation with this AI Agent
This n8n workflow transforms into an intelligent AI Agent capable of interacting with users via chat to provide movie recommendations. It leverages OpenAI's language understanding to interpret user requests, dynamically constructs MongoDB aggregation pipelines to fetch relevant movie data, and can even store a user's favorite movies back into the database. This agent acts as your personal movie connoisseur, understanding your queries and providing tailored suggestions from your movie collection.
Key Features & Benefits
- AI-Driven Query Generation: Uses OpenAI to translate natural language chat input into complex MongoDB aggregation queries. No need to manually write database queries for common requests.
- Dynamic Data Retrieval: Fetches movie details (plot, genres, cast, year, ratings, etc.) from your MongoDB collection based on the AI-generated pipeline.
- Interactive Chat Interface: Responds to user messages received via a webhook, enabling a conversational experience.
- Contextual Memory: Employs window buffer memory to maintain conversation context for more relevant follow-up interactions.
- Favorite Movie Storage: Includes a tool to insert favorite movies (by title) into a MongoDB collection, powered by a sub-workflow.
- Customizable Movie Schema: The agent can be adapted to your specific movie data structure in MongoDB.
- Streamlined Automation: Automates the process of searching and curating movie information, saving time and effort.
Use Cases
- For B2C e-commerce: Develop interactive AI assistants that recommend products from your database based on conversational user queries.
- For B2B SaaS: Create AI-powered internal tools for querying application databases (e.g., customer data, feature usage) using natural language.
- For founders/solopreneurs: Rapidly prototype AI agents that interface with data stores to provide personalized user experiences or data insights.
- Automating movie lookups and personalized recommendations for media enthusiasts or community platforms.
- Building a smart movie database interface that understands natural language for quick information retrieval.
Prerequisites
- An n8n instance (Cloud or self-hosted).
- OpenAI API Key with access to a suitable chat model.
- MongoDB credentials and a database with a movie collection (e.g., named 'movies').
- The related 'insertMongoDB' n8n workflow (referenced by ID '6QuKnOrpusQVu66Q' in the template) for the 'insertFavorite' functionality, or be prepared to adapt this tool.
Setup Instructions
- Download the n8n workflow JSON file.
- Import the workflow into your n8n instance.
- Configure the 'OpenAI Chat Model' node: Select your OpenAI credential or enter your API Key.
- Configure the 'MongoDBAggregate' node: Select your MongoDB credential. Ensure the 'collection' parameter (default 'movies') matches your database. Review and update the 'toolDescription' with your movie document structure if it differs from the example.
- Configure the 'insertFavorite' (Tool Workflow) node: Ensure the 'Workflow ID' points to your 'insertMongoDB' workflow (or a similar workflow you've created for inserting data). The template expects a workflow with ID
6QuKnOrpusQVu66Q
that accepts a title to insert. - Review the system prompt in the 'AI Agent - Movie Recommendation' node to customize the agent's behavior, instructions, or the fields it considers.
- The 'When chat message received' trigger node exposes a public webhook. Copy this URL to interact with your AI agent.
- Activate the workflow and start chatting with your AI Movie Recommendation Agent.
Want your own unique AI agent?
Talk to us - we know how to build custom AI agents for your specific needs.
Schedule a Consultation