Animated data flow diagram

AI-Powered Factoid Subscription Agent with n8n, Groq & OpenAI

Version: 1.0.0 | Last Updated: 2025-05-16

Integrates with:

Airtable Gmail Groq OpenAI Langchain

Overview

Unlock Automated Content Delivery with this AI Agent

This n8n workflow acts as an AI Agent capable of managing a full-cycle content subscription service. It allows users to subscribe via an n8n form, choosing a topic and delivery frequency (daily, weekly, or 'surprise me'). The agent then uses Groq's Llama 3.3 model (via the Langchain 'Content Generation Agent' node which also has access to a Wikipedia tool) to generate unique factoids on the chosen topic and OpenAI (via the Langchain 'Generate Image' node) to create a complementary image. Emails are assembled and sent via Gmail. It also handles unsubscriptions and logs activity in Airtable.

Key Features & Benefits

  • AI-Driven Content Creation: Automatically generates unique textual factoids using Groq (Llama 3.3) and relevant images using OpenAI, ensuring fresh content for subscribers.
  • Subscription Management: Handles user subscriptions and unsubscriptions through n8n forms, storing and updating preferences in Airtable.
  • Flexible Scheduling: Delivers content daily, weekly, or on a 'surprise' basis, catering to different user preferences.
  • Personalized Content Delivery: Sends tailored factoids based on user-selected topics directly to their email.
  • Automated Email Dispatch: Uses Gmail to send out the generated content, complete with text, image, and unsubscribe links.
  • Scalable Architecture: Leverages n8n subworkflows for concurrent email processing, ensuring efficiency even with a growing subscriber base.
  • Data Logging: Keeps track of sent emails and subscriber status in Airtable for easy monitoring and analysis.
  • Unique Content Memory: Utilizes Langchain's Window Buffer Memory to help the Content Generation Agent avoid sending repetitive factoids to the same user.

Use Cases

  • **B2C E-commerce**: Launch a 'Tip of the Day/Week' related to your product niche (e.g., 'Gardening Tip of the Day' for a plant store) to keep customers engaged and drive traffic back to your site.
  • **B2B SaaS**: Deliver 'Productivity Hacks' or 'Industry Insights' weekly to your user base, establishing thought leadership and increasing product stickiness.
  • **Solopreneurs/Creators**: Offer exclusive AI-generated content (e.g., 'Daily Creative Prompt', 'Weekly Market Analysis Snippet') as a lead magnet or a value-add for a paid community.
  • **Educational Platforms**: Automate the delivery of daily/weekly learning snippets or fun facts to subscribers to enhance engagement and continuous learning.

Prerequisites

  • An n8n instance (Cloud or self-hosted).
  • Airtable account and Personal Access Token.
  • A copy of the sample Airtable base to store subscriber data: https://airtable.com/appL3dptT6ZTSzY9v/shrLukHafy5bwDRfD
  • Gmail account with OAuth2 credentials configured in n8n.
  • Groq API Key.
  • OpenAI API Key (for image generation).
  • Langchain nodes (@n8n/n8n-nodes-langchain) installed in your n8n instance.

Setup Instructions

  1. Download the n8n workflow JSON file.
  2. Import the workflow into your n8n instance.
  3. Configure Airtable Nodes: a. In the following nodes: 'Search daily', 'Search weekly', 'Search surprise', 'Create Subscriber', 'Update Subscriber', and 'Log Last Sent', update the Airtable credentials with your Personal Access Token. b. Ensure the 'Base ID' and 'Table ID' in these nodes correspond to your copied Airtable base and table.
  4. Configure Gmail Nodes: a. In the 'confirmation email1' and 'Send Message' nodes, select or create your Gmail OAuth2 credentials.
  5. Configure AI Nodes: a. In the 'Groq Chat Model' node (connected to 'Content Generation Agent'), enter your Groq API Key. b. In the 'Generate Image' node (OpenAI), enter your OpenAI API Key.
  6. Set Up Forms & Links: a. The 'Subscribe Form' uses the path free-factoids-subscribe and the 'Unsubscribe Form' uses free-factoids-unsubscribe. Your n8n instance URL for these forms (e.g., https://your-n8n-domain.com/form/free-factoids-subscribe) must be publicly accessible for users to subscribe/unsubscribe. b. In the 'Set Email Vars' node, update the unsubscribe_link value: replace <MY_HOST> with your actual n8n public URL (e.g., https://your-n8n-domain.com). Ensure the form path in this link (e.g., /form/inspiration-unsubscribe) matches the path configured in your 'Unsubscribe Form' node (which is free-factoids-unsubscribe in the template, so you may need to update the link path to /form/free-factoids-unsubscribe).
  7. Review Subworkflow: The 'Execute Workflow' node is configured to call the current workflow ID (={{ $workflow.id }}) to process each subscriber email concurrently. This is a standard setup and usually requires no changes.
  8. Customize Content (Optional): a. Modify the prompt in the 'Content Generation Agent' node to tailor the style or type of factoids. b. Adjust the image generation prompt in the 'Generate Image' node if needed. c. Customize the email templates in the 'confirmation email1' and 'Set Email Vars' (for the main message) nodes.
  9. Activate the workflow. Test the entire process: subscription, receiving a factoid email (check daily, weekly, surprise logic if possible), and unsubscription.

Tags:

AI AgentContent AutomationEmail MarketingGroqOpenAILangchainAirtableSubscription ServiceImage Generation

Want your own unique AI agent?

Talk to us - we know how to build custom AI agents for your specific needs.

Schedule a Consultation