Quick Overview
This workflow watches a Google Sheets donations log, validates new entries, uses DeepSeek (via the OpenAI API) to draft personalized thank-you emails with receipt details, and sends them via Gmail, while notifying the team in Telegram and emailing weekly donation digests.
How it works
- Triggers when a new row is added to the Google Sheets “Donations” worksheet (polled every minute).
- Normalizes the donation data by generating a donation ID, timestamp, and default values, then validates that donor name, donor email, and a positive amount are present.
- If the row is invalid, sends an alert to Telegram and emails a review notice via Gmail so the sheet can be corrected.
- If the row is valid, uses a LangChain agent with the DeepSeek chat model and a Google Sheets donor-history tool to generate a JSON thank-you email (tier, subject, body, and major-donor flag).
- Logs the generated message and donation details to the Google Sheets “ThankYouLog” worksheet and emails the thank-you (including receipt details) to the donor via Gmail.
- If the donation qualifies as major (AI-flagged or amount ≥ 1,000,000), posts a Telegram alert and emails the executive director via Gmail for personal outreach.
- Every Monday at 09:00, reads the “ThankYouLog” sheet, calculates weekly donation stats, generates a short AI digest, and sends it via Gmail and Telegram (or sends an all-clear if no donations were logged).
Setup
- Connect Google Sheets OAuth credentials for both the Google Sheets trigger and Google Sheets nodes, and set the spreadsheet ID and worksheet names (Donations, DonorHistory, ThankYouLog).
- Add an OpenAI API credential that can access the DeepSeek model configured in the workflow.
- Add a Gmail OAuth2 credential and update the recipient addresses used for donor emails and internal notifications.
- Add a Telegram bot credential and set the target chat ID for invalid-donation, major-donor, and weekly-digest messages.
- Ensure the Donations sheet includes donor_name, donor_email, amount, currency, campaign, gift_message, and source columns, and populate DonorHistory with donor records keyed by email.