Skip to content
NEWMarketplace and the trig8n Agent: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / Email Automation

Email Automation

Generate Win-Back Offers with Gemini and Send Them via Gmail

Runs on a schedule to take eligible churned customers, use Gemini to draft a personalized win-back offer for each, log it to Google Sheets and email it through Gmail.

What it does

# 02. Generate & Send Win-Back Offer (Loop) Purpose: Processes each eligible customer found in the previous step individually within a loop. 1. Generate Offer (Gemini): Uses Google Gemini to create a personalized win-back offer (Informational, Bonus Points, or Discount) based on the customer's predicted_churn_score and preferred_categories. Outputs offer details in JSON format. 2. Log Sent Offer: Records the successful generation and intent to send the offer (action_taken, timestamp, customer_id) in the 'SYSTEM_LOG' Google Sheet. 3. Send Email (Gmail): Sends the generated offer details (offer_title and offer_details) via email to the customer's user_mail. The loop continues until all eligible customers are processed.

The steps

  1. Scheduled Start: Daily Churn Check
  2. Fetch Customer Data from Sheet
  3. Filter High Churn Risk & No Campaign Customers
  4. Check if Eligible Customers Found
  5. Process Each Eligible Customer
  6. Generate Win-Back Offer
  7. (LLM Model for Offer Generation)
  8. (Parse Offer JSON)
  9. Log Sent Offer in System Log
  10. Send Win-Back Offer via Email
  11. Set 'Not Found' Status
  12. Log 'Not Found' in System Log
  13. Error Handler

Similar automations