This workflow listens for incoming book request emails, extracts the user's intent using the Ollama LLM, queries book data (title, summary, details) via an API, and sends a personalized recommendation email. Ideal for automated book suggestions using LLMs and structured APIs, great for newsletters, reading clubs, and educational bots.
How It Works
- Email Request: Triggers the workflow when a new email with a book request is received.
- Analyze Email with Ollama: Extracts user intent and book preferences using the Ollama LLM.
- Create Book Search Query: Generates a query based on the analyzed intent.
- Book Search API: Fetches book data (title, summary, details) from an API.
- Check API Response: Validates the API response for book availability.
- Handle No Book Found: Manages cases where no suitable book is found.
- Extract Book Summary: Pulls the summary from the API response.
- Wait for Summary Response: Pauses to ensure summary data is ready.
- Retrieve Book Details: Gathers additional book details.
- Format Book Data: Structures the book information for the recommendation.
- Enhance Data with Code: Refines the data using custom code.
- Generate Email Content: Creates a personalized email recommendation.
- Send Email: Delivers the recommendation to the user.
How to Use
- Import the workflow into n8n.
- Configure email credentials for the Email Request node.
- Set up Ollama LLM API credentials and endpoint.
- Configure the Book Search API with appropriate credentials and endpoint.
- Test with a sample email requesting a book recommendation.
- Adjust the Generate Email Content node for custom email templates if needed.
- Ensure the Send Email node is linked to a valid email service.
Requirements
- Email service API credentials (e.g., Gmail, SMTP)
- Ollama LLM API access
- Book Search API credentials
Customizing This Workflow
- Modify the Analyze Email with Ollama node to refine intent extraction for specific genres.
- Adjust the Book Search API query to target different book databases.
- Customize the Generate Email Content node to include additional details like author bios.