{
  "name": "Send post-purchase emails from Postgres with Gmail and Groq AI",
  "nodes": [
    {
      "id": "4a32e11b-0b14-40d7-aa64-c3a9ca56835c",
      "name": "Wait until product get deliver",
      "type": "n8n-nodes-base.wait",
      "position": [
        1248,
        320
      ]
    },
    {
      "id": "83e3c23e-3f20-4993-b5b7-d87f0dcfaabc",
      "name": "Wait for 2 weeks",
      "type": "n8n-nodes-base.wait",
      "position": [
        2688,
        240
      ]
    },
    {
      "id": "b48ab0b4-1747-48a3-8562-807169094255",
      "name": "Format AI response",
      "type": "n8n-nodes-base.code",
      "position": [
        2336,
        240
      ]
    },
    {
      "id": "ba84ac7c-da4e-452c-9241-190ff673bb78",
      "name": "Order Placed Ack.",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1040,
        320
      ]
    },
    {
      "id": "923fc1a9-f06c-41c8-acca-d1f6976b6380",
      "name": "Get Product Usage Tips",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2032,
        240
      ]
    },
    {
      "id": "00374acb-792e-44cc-80dd-5928fe83be20",
      "name": "Send Tips to User",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2512,
        240
      ]
    },
    {
      "id": "5a26b805-5130-4de6-b852-91e5e6c48229",
      "name": "Get Complementary Products",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2864,
        240
      ]
    },
    {
      "id": "abc44bb7-175c-4a3b-a216-609fb0b0db5e",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        3168,
        240
      ]
    },
    {
      "id": "5cd6110c-df5b-40f4-a463-7f7f0496c139",
      "name": "Send Tips to User1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3360,
        240
      ]
    },
    {
      "id": "c8a66438-5763-4eda-9084-76c55f921256",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        656,
        320
      ]
    },
    {
      "id": "40da5167-6e26-4d1a-9de2-7c866738bc7a",
      "name": "Execute a SQL query",
      "type": "n8n-nodes-base.postgres",
      "position": [
        848,
        320
      ]
    },
    {
      "id": "b85971cf-b0de-482f-aec4-21c1fb5725ea",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1616,
        320
      ]
    },
    {
      "id": "5432f11d-e880-489f-928c-987215922205",
      "name": "Select rows from a table",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1440,
        320
      ]
    },
    {
      "id": "63a47401-9647-4fdb-a8ed-457c23fd9e6a",
      "name": "Wait for a day",
      "type": "n8n-nodes-base.wait",
      "position": [
        1808,
        416
      ]
    },
    {
      "id": "074ed9a7-b999-44c3-9175-ec15843f8134",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        2080,
        464
      ]
    },
    {
      "id": "31682f41-9d9f-44c6-8305-e80e0c4e8d6c",
      "name": "Groq Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        2912,
        448
      ]
    },
    {
      "id": "be190506-bfaa-4c93-b220-581161631558",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        0
      ],
      "parameters": {
        "width": 768,
        "height": 752,
        "content": "## Step 2 - Delivery Status Check\nWaits for delivery and rechecks the order status until it is marked as delivered.\n"
      }
    },
    {
      "id": "99169450-5335-4d36-a0fb-656825eab5df",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2000,
        0
      ],
      "parameters": {
        "width": 624,
        "height": 752,
        "content": "## Step 3 - Product Usage Tips (AI)\nGenerates product usage tips using AI and sends them to the customer."
      }
    },
    {
      "id": "c74ab52c-e07a-4ef0-a1e9-7381155d55ae",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2656,
        0
      ],
      "parameters": {
        "width": 896,
        "height": 752,
        "content": "## Step 4 - Product Recommendations (AI)\nWaits 2 weeks and sends AI-generated complementary product recommendations based on last purchase.\n"
      }
    },
    {
      "id": "8ec1bda5-146f-4301-99b7-9bce9e58fa31",
      "name": "Step -1 Trigger & Order Detection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        0
      ],
      "parameters": {
        "width": 560,
        "height": 752,
        "content": "## Step 1 - Order Detection & Confirmation Email\nDetects new orders placed  and sends an order confirmation email.\n\n"
      }
    },
    {
      "id": "40edc986-ad23-4ab5-a71e-463bab9b64f2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 576,
        "height": 752,
        "content": "## Order Placed → Delivery-Based Upsell Automation\n\nThis workflow automates post-purchase engagement by confirming new orders, tracking delivery status, sending helpful product usage tips, and followi"
      }
    }
  ],
  "connections": {
    "If": {
      "main": [
        [],
        [
          {
            "node": "Wait for a day",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for a day": {
      "main": [
        [
          {
            "node": "Select rows from a table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Execute a SQL query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Order Placed Ack.": {
      "main": [
        [
          {
            "node": "Wait until product get deliver",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Tips to User": {
      "main": [
        [
          {
            "node": "Wait for 2 weeks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Send Tips to User1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format AI response": {
      "main": [
        [
          {
            "node": "Send Tips to User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute a SQL query": {
      "main": [
        [
          {
            "node": "Order Placed Ack.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select rows from a table": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until product get deliver": {
      "main": [
        [
          {
            "node": "Select rows from a table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}