Send AI-powered post-purchase emails and WhatsApp messages from PostgreSQL to Google Sheets with Groq
Ready for 3.0What this workflow does
This AI workflow has 13 nodes and runs on Postgres events. Along the way it connects Postgres, Groq Chat Model, Gmail and WhatsApp Business Cloud and 1 more.
How it runs
Trigger: On Postgres events.
- Execute a SQL query (Postgres): run a query
- Loop Over Items (Loop Over Items (Split in Batches)): loops over the items in batches
- Execute a SQL query (Postgres): run a query
- AI Agent: runs an AI agent, with model: Groq Chat Model
- Merge: merges the data from its input branches
- Format AI response (Code): runs custom JavaScript code
- Send a message (Gmail): uses Gmail
- Send message (WhatsApp Business Cloud): send
- Edit Fields (Edit Fields (Set)): sets 8 fields: customer_name, product_name, email…
- Append row in sheet (Google Sheets): append
…plus 1 more step. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (12)
- Postgres Trigger
n8n-nodes-base.postgresTrigger - Postgres
n8n-nodes-base.postgres - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - AI Agent
@n8n/n8n-nodes-langchain.agent - Groq Chat Model
@n8n/n8n-nodes-langchain.lmChatGroq - Code
n8n-nodes-base.code - Gmail
n8n-nodes-base.gmail - Merge
n8n-nodes-base.merge - WhatsApp Business Cloud
n8n-nodes-base.whatsApp - Edit Fields (Set)
n8n-nodes-base.set - Google Sheets
n8n-nodes-base.googleSheets - Wait
n8n-nodes-base.wait
From the author
How it works This workflow automatically detects completed orders in PostgreSQL and prepares them for AI-based post-purchase communication. It enriches each order with customer, product, and payment data, then generates a personalized message using an AI…