{
  "name": "Send post-purchase email sequences with Postgres, Gmail and OpenAI",
  "nodes": [
    {
      "id": "e7a7d230-8eb4-45b8-8cc4-4756af647e3d",
      "name": "Wait until product get deliver",
      "type": "n8n-nodes-base.wait",
      "position": [
        -448,
        2832
      ]
    },
    {
      "id": "adea234b-a3ec-4389-a447-aae6f0da6f4c",
      "name": "Wait for 2 weeks",
      "type": "n8n-nodes-base.wait",
      "position": [
        992,
        2752
      ]
    },
    {
      "id": "ee34d1d3-8db9-4c38-a247-8643da4a8c6f",
      "name": "Order Placed Ack.",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -656,
        2832
      ]
    },
    {
      "id": "8947ca5e-3169-4f57-a612-202237dd6f4c",
      "name": "Send Tips to User",
      "type": "n8n-nodes-base.gmail",
      "position": [
        816,
        2752
      ]
    },
    {
      "id": "06d92300-d3bc-4dd7-a492-685ee0b8db77",
      "name": "Send Tips to User1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1664,
        2752
      ]
    },
    {
      "id": "823df403-fb23-4ec1-bae5-014a17fd9b3e",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1040,
        2832
      ]
    },
    {
      "id": "9d16a835-0279-4404-93ae-def9a202fb28",
      "name": "Execute a SQL query",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -848,
        2832
      ]
    },
    {
      "id": "690aca95-d69a-4e96-89fb-68c92da121a1",
      "name": "Select rows from a table",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -256,
        2832
      ]
    },
    {
      "id": "3cd9eb5f-0f9f-4946-a996-d7a54fc34f51",
      "name": "Wait for a day",
      "type": "n8n-nodes-base.wait",
      "position": [
        112,
        2928
      ]
    },
    {
      "id": "b860995e-3e7c-43d8-b7f6-5df2dcf674e9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        2512
      ],
      "parameters": {
        "width": 768,
        "height": 752,
        "content": "## Step 2 — Delivery Status Check\nWaits for delivery and rechecks order status until delivered.\n"
      }
    },
    {
      "id": "a0bd7ba6-5a92-4ce2-a51a-d147e6c19303",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        2512
      ],
      "parameters": {
        "width": 624,
        "height": 752,
        "content": "## Step 3 — Product Usage Tips (AI)\nGenerates and emails AI-based usage tips after delivery.\n"
      }
    },
    {
      "id": "b3a36d91-de29-4e23-9046-ce4b5e7bf291",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        2512
      ],
      "parameters": {
        "width": 896,
        "height": 752,
        "content": "## Step 4 — Upsell Recommendations (AI)\nWaits two weeks and sends AI-generated complementary product suggestions.\n"
      }
    },
    {
      "id": "1591c534-c64c-413b-bb5d-a91745e1d9d0",
      "name": "Step -1 Trigger & Order Detection",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        2512
      ],
      "parameters": {
        "width": 560,
        "height": 752,
        "content": "## Step 1 — Order Detection & Confirmation\nFetches new orders and sends an order confirmation email to the customer.\n"
      }
    },
    {
      "id": "aad79404-5b69-473f-95ca-d6c410788a39",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1696,
        2512
      ],
      "parameters": {
        "width": 576,
        "height": 752,
        "content": "## Order Placed → Delivery-Based Upsell Automation\n\nThis workflow automates post-purchase customer engagement using email and AI. It confirms new orders, waits for delivery, sends helpful product usag"
      }
    },
    {
      "id": "7bb156f5-ed86-49f5-9512-38d552a41f98",
      "name": "Format AI response3",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        2752
      ]
    },
    {
      "id": "8ba50f01-d769-4f65-ba3f-e23ee07c90b1",
      "name": "Code in JavaScript1",
      "type": "n8n-nodes-base.code",
      "position": [
        1472,
        2752
      ]
    },
    {
      "id": "f2e95170-467e-43b7-86b3-5b443b67f789",
      "name": "If2",
      "type": "n8n-nodes-base.if",
      "position": [
        -80,
        2832
      ]
    },
    {
      "id": "dffda946-f2d4-440b-b401-d2ae9013a203",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        336,
        2752
      ]
    },
    {
      "id": "2c54f67f-4f7e-4cd8-8647-9079007a1ce9",
      "name": "Message a model1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1184,
        2752
      ]
    }
  ],
  "connections": {
    "If2": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for a day",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for a day": {
      "main": [
        [
          {
            "node": "Select rows from a table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Format AI response3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model1": {
      "main": [
        [
          {
            "node": "Code in JavaScript1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Execute a SQL query",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for 2 weeks": {
      "main": [
        [
          {
            "node": "Message a model1",
            "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 JavaScript1": {
      "main": [
        [
          {
            "node": "Send Tips to User1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute a SQL query": {
      "main": [
        [
          {
            "node": "Order Placed Ack.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format AI response3": {
      "main": [
        [
          {
            "node": "Send Tips to User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Select rows from a table": {
      "main": [
        [
          {
            "node": "If2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait until product get deliver": {
      "main": [
        [
          {
            "node": "Select rows from a table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}