Global AI Network
Agent Template v1.0.0

Weekly E-commerce Promotion Emails with Algolia and Gmail

4+
Deployments
5m
Setup Time
Free
Pricing

Need custom configuration?

Our solution engineers can help you adapt this agent to your specific infrastructure and requirements.

Enterprise Grade Best Practices Production Optimized

INTEGRATED_MODULES

Gmail
Gmail
Google Sheets
Google Sheets
Step by Step

Setup Tutorial

mission-briefing.md

What This Agent Does

This Weekly Newsletter Automation Agent transforms your sales data into engaging newsletters and delivers them directly to your subscribers every week. By connecting your product catalog, email list, and Gmail account, this workflow automatically fetches your latest on-sale items, formats them into a professional newsletter, and sends personalized emails to your entire subscriber base—all without lifting a finger.

Key benefits and time savings:

  • Eliminate manual work: Automatically fetch products and send newsletters on a fixed schedule, saving 3-4 hours per week
  • Consistent engagement: Reach subscribers every week with fresh, relevant content about your sales
  • Error prevention: Automatically validates email addresses before sending, reducing bounce rates and protecting your sender reputation
  • Scalability: Send to hundreds or thousands of subscribers simultaneously without performance degradation
  • Data-driven insights: Maintain a clean subscriber list in Google Sheets for easy management and analysis

Target use cases:

  • E-commerce businesses promoting weekly sales and new arrivals
  • SaaS companies sharing product updates and feature releases
  • Content creators distributing curated weekly digests
  • Retail brands maintaining customer engagement through regular promotions
  • Agencies managing client newsletters at scale

Who Is It For

This agent is perfect for marketing teams, e-commerce managers, and business owners who want to maintain consistent customer communication without the operational overhead. You don't need coding experience—just basic familiarity with Google Sheets and email management. Whether you're running a small online store or managing multiple product lines, this workflow scales to your needs.

Ideal candidates have:

  • A product catalog accessible via Algolia (or similar search API)
  • A Google Sheets document containing subscriber email addresses
  • A Gmail account with SMTP access enabled
  • A need to send newsletters on a consistent weekly schedule

Required Integrations

Google Sheets

Why it's needed: Google Sheets serves as your subscriber database, storing all email addresses and subscriber information in an organized, accessible format. This integration allows TaskAGI to read your subscriber list dynamically, ensuring you always send to your current audience without manual updates.

Setup steps:

  1. Create a Google Sheet with your subscriber data

    • Open Google Sheets and create a new spreadsheet
    • Name it something descriptive like "Newsletter Subscribers"
    • Add column headers in the first row: Email, Name, Status (or your preferred structure)
    • Populate rows with subscriber information
  2. Share the sheet with appropriate permissions

    • Click the "Share" button in the top-right corner
    • Set permissions to "Editor" for the TaskAGI service account
    • Copy the sheet URL (you'll need this for configuration)
  3. Enable Google Sheets API in Google Cloud Console

    • Visit Google Cloud Console
    • Create a new project or select an existing one
    • Enable the Google Sheets API
    • Create a service account and download the JSON credentials file
  4. Configure in TaskAGI

    • Navigate to IntegrationsGoogle Sheets
    • Paste your credentials JSON file
    • Test the connection by selecting your spreadsheet
    • Verify that TaskAGI can read your subscriber data

Gmail

Why it's needed: Gmail is your email delivery engine, sending newsletters to each subscriber with proper formatting, tracking, and reliability. This integration ensures emails arrive in inboxes with professional formatting and maintains your sender reputation.

Setup steps:

  1. Enable 2-Step Verification on your Gmail account

    • Go to Google Account Security
    • Enable 2-Step Verification if not already active
    • This is required for app-specific passwords
  2. Generate an App Password

    • Return to Security settings
    • Find "App passwords" (only visible with 2-Step Verification enabled)
    • Select "Mail" and "Windows Computer" (or your device type)
    • Google will generate a 16-character password—copy this securely
  3. Configure in TaskAGI

    • Navigate to IntegrationsGmail
    • Enter your Gmail address (e.g., your-email@gmail.com)
    • Paste the 16-character app password in the password field
    • Click "Test Connection" to verify authentication
    • Confirm that TaskAGI can send test emails
  4. Optional: Configure sender details

    • Set a "From" name (e.g., "Your Company Newsletter")
    • Add a reply-to address if different from your Gmail
    • Enable read receipts or tracking if desired

Configuration Steps

Step 1: Define Your Workflow Metadata

Start by filling in the Agent Name Options, Category and Industry, and Workflow Overview nodes. These documentation nodes help you and your team understand the workflow's purpose.

  • Agent Name: Enter something clear like Weekly Sales Newsletter
  • Category: Select Marketing or Sales
  • Industry: Choose your industry (e.g., E-commerce, SaaS)
  • Overview: Write a brief description: "Automatically sends weekly newsletters featuring on-sale products to all subscribers"

Step 2: Configure the Weekly Schedule Trigger

The Weekly Schedule node determines when your newsletter runs automatically.

  • Trigger Type: Select Schedule Interval
  • Frequency: Choose Weekly
  • Day: Select your preferred day (e.g., Monday)
  • Time: Set the time in UTC (e.g., 09:00 for 9 AM UTC)
  • Timezone: Adjust for your local timezone in the display settings

Example: If you want newsletters sent every Monday at 9 AM EST, set the time to 14:00 UTC (accounting for the 5-hour difference).

Step 3: Fetch Products from Algolia

The Fetch Products from Algolia node retrieves your on-sale items from your product catalog.

Configure the HTTP request with these parameters:

{
  "filters": "on_sale:true",
  "hitsPerPage": 6,
  "attributesToRetrieve": ["name", "price", "image_url", "description"]
}
  • Endpoint: Your Algolia API endpoint (provided in your Algolia dashboard)
  • Authentication: Use your Algolia API key (found in Settings → API Keys)
  • Filters: The on_sale:true filter ensures only discounted products appear
  • hitsPerPage: Set to 6 to feature 6 products per newsletter (adjust as needed)

Step 4: Process Products and Generate Newsletter

The Process Products and Generate Newsletter function transforms raw product data into formatted HTML.

This node should:

  • Extract product names, prices, images, and descriptions
  • Format them into an HTML template with professional styling
  • Create a subject line (e.g., "This Week's Best Deals - Save Now!")
  • Store the output in variables: [[nodes.6.subject]] and [[nodes.6.html]]

Example function logic:

subject = "Weekly Newsletter: " + current_date
html = "<h1>This Week's Best Deals</h1>"
for each product:
  html += "<div class='product'><img src='" + product.image + "'><h3>" + product.name + "</h3><p>$" + product.price + "</p></div>"

Step 5: Retrieve Subscriber List

The Get Subscribers from Google Sheets node reads your subscriber data.

  • Sheet URL: Paste your Google Sheets URL (from Step 1 of Google Sheets setup)
  • Sheet Name: Specify the worksheet name (default: Sheet1)
  • Range: Leave as A:Z to capture all data, or specify A1:B100 for specific columns
  • Headers: Enable "First row contains headers" if applicable

Step 6: Loop Through Subscribers

The Loop Through Subscribers node iterates through each row in your subscriber list.

  • Input: Connect to the output from the Google Sheets node
  • Loop Variable: Set to iterate through each row
  • Output: Each iteration passes one subscriber's data to the next node

Step 7: Extract Email from Row

The Extract Email from Row function pulls the email address from each subscriber record.

  • Input: Current loop iteration (subscriber row)
  • Output Variable: [[nodes.9.email]]
  • Logic: Extract the email column (e.g., column A or the "Email" column)

Step 8: Validate Email Address

The Check Valid Email condition verifies that each email is properly formatted before sending.

  • Condition: email matches regex /^[^\s@]+@[^\s@]+\.[^\s@]+$/
  • True Path: Proceed to send email (Step 9)
  • False Path: Skip to no-operation node (Step 10)

This prevents sending to malformed addresses and protects your sender reputation.

Step 9: Send Newsletter Email

The Send Newsletter Email node delivers the newsletter to valid subscribers.

Configure these fields:

  • To: [[nodes.9.email]] (the extracted email address)
  • Subject: [[nodes.6.subject]] (from the newsletter generation node)
  • Body: [[nodes.6.html]] (the formatted HTML newsletter)
  • From: Your Gmail address (auto-populated from integration)
  • Content Type: Select HTML to preserve formatting
  • Optional: Add reply-to address, CC, or BCC as needed

Step 10: Skip Invalid Emails

The Skip Invalid Email node is a no-operation placeholder for invalid addresses, ensuring the workflow continues without errors.

Testing Your Agent

Pre-Launch Testing

  1. Test the Algolia connection

    • Run the workflow manually (don't wait for the schedule)
    • Verify that products are fetched correctly
    • Check that the on_sale:true filter returns expected results
    • Review the product data in the execution logs
  2. Test the Google Sheets integration

    • Confirm that subscriber data loads successfully
    • Verify email addresses are extracted correctly
    • Check that the loop processes all rows without errors
  3. Test email generation

    • Review the generated newsletter HTML in the logs
    • Verify that the subject line is clear and professional
    • Check that product information is formatted correctly
  4. Send a test email

    • Modify the workflow temporarily to send only to your own email address
    • Verify that the email arrives in your inbox
    • Check formatting, images, and links in your email client
    • Test on mobile and desktop views
  5. Validate email filtering

    • Add a test row with an invalid email (e.g., invalid-email) to your Google Sheet
    • Run the workflow and confirm it skips the invalid address
    • Verify that valid emails still send successfully

Success Indicators

✅ All products fetch from Algolia without errors
✅ Newsletter HTML renders correctly with images and formatting
✅ All valid subscriber emails receive the newsletter
✅ Invalid emails are skipped without stopping the workflow
✅ Workflow completes within expected time (typically under 2 minutes)
✅ No errors appear in the execution logs

Once testing is complete, enable the weekly schedule and monitor the first few automated runs to ensure consistent performance!