๐ฌ Send post-purchase email sequences with Postgres, Gmail and OpenAI
โก 8 views ยท ๐ฌ Lead Nurturing & AI Sales Agents
Description
How it works
This workflow automates customer communication after an order is placed. It detects new orders, sends a confirmation email, waits until delivery is completed, and then follows up with AI-generated product tips. Finally, it sends AI-powered upsell recommendations after a defined delay. The workflow runs on a schedule and requires no manual handling.
Step-by-step
-
Step 1 โ Order detection and confirmation
- Schedule Trigger โ Runs at a fixed interval to check for new orders.
- Postgres โ Execute a SQL query โ Fetches recently created orders from the database.
- Gmail โ Send message โ Sends an order confirmation email to the customer.
-
Step 2 โ Delivery status monitoring
- Wait โ Pauses the workflow until the expected delivery window.
- Postgres โ Select rows โ Checks the delivery status of the order.
- If โ Verifies whether the product is marked as delivered.
- Wait โ Delays one day and repeats the check if delivery is not completed.
-
Step 3 โ Product usage tips (AI)
- OpenAI โ Message a model โ Generates short and practical usage tips for the product.
- Code โ Formats the AI output into clean HTML bullet points.
- Gmail โ Send message โ Emails the usage tips to the customer.
-
Step 4 โ Upsell recommendations (AI)
- Wait โ Delays for two weeks after tips are sent.
- OpenAI โ Message a model โ Creates complementary product recommendations.
- Code โ Formats the recommendations for email delivery.
- Gmail โ Send message โ Sends the upsell email to the customer.
Why use this?
- Ensures timely and relevant customer communication
- Prevents sending tips before the product is delivered
- Improves onboarding with AI-generated usage guidance
- Increases repeat purchases through smart upsell emails
- Fully automated using database, email, and AI integrations
๐ Nodes Used
Postgres, Gmail, Schedule Trigger, OpenAI
๐ฅ Import
Download workflow.json and import into n8n:
Workflow menu โ Import from File