{
  "name": "Automated template delivery system with Stripe, GPT-4o & Gmail",
  "nodes": [
    {
      "id": "efc2eba5-5d82-44f0-812c-706e23a06b30",
      "name": "Azure OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        2512,
        1472
      ]
    },
    {
      "id": "9ea2dde1-5ace-4dbb-8e9c-6303f05fee4b",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2672,
        1472
      ]
    },
    {
      "id": "c32e339f-f9f6-4d9a-bce0-dff7d4d9f07f",
      "name": "Azure OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        688,
        1472
      ]
    },
    {
      "id": "10aa26f0-0725-495f-89bc-2a10da48df23",
      "name": "Structured Output Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        944,
        1472
      ]
    },
    {
      "id": "a4c6fb7f-36b1-4d8d-b6dc-008f806306a9",
      "name": "Get row(s) in sheet in Google Sheets",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        816,
        1472
      ]
    },
    {
      "id": "9152cb4e-8636-4313-aa52-f551c8a9d42b",
      "name": "Get Payment Intent (From Charge)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -656,
        1296
      ]
    },
    {
      "id": "32405012-4ca8-496c-89ea-086c3f980e21",
      "name": "Get Product Details (from Payment Intent)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -208,
        1216
      ]
    },
    {
      "id": "67670bdd-0ca6-404e-9127-d57d3d44f606",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "position": [
        -432,
        1216
      ]
    },
    {
      "id": "fdcc6c45-3d67-4e21-8c3b-dbcafe8ff891",
      "name": "Customer matching",
      "type": "n8n-nodes-base.code",
      "position": [
        1600,
        1264
      ]
    },
    {
      "id": "5f3a1fc9-950c-430a-adbb-c52c3cf09001",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        1520
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "5490051b-e8df-49df-b7ba-2c08a1f61fd4",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        1168
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "67c268a3-8f66-440a-9f0b-b1aa78dc9b37",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2832,
        1040
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "d54a6b39-c931-4b53-96b4-b34583c9bd77",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2464,
        1008
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "d4e83f8c-097e-4ed7-8e71-a5a6a461064d",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2224,
        1568
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "4856afcc-8641-441e-92f1-57116d973120",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2048,
        1136
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "33dfa14b-73b4-4318-8d03-9befa25b9aff",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1872,
        1520
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "c319fec4-bf8d-41fc-86e4-07382ff176f3",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1600,
        992
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "b85be8c6-11f0-4505-b9a7-9a32fa6f65f4",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1552,
        1632
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "d179d8ba-eef0-44fa-aedf-ccf3b33a9c01",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        1536
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "c9b30bd0-9bbd-4b47-baca-cac27d5325a5",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1056,
        1040
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "cde55b8d-7bcd-47ba-8dbe-951379b80421",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        992
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "fcae0ff6-e228-4d88-8542-0f5744b565bd",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        1520
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "b1d8bcf2-3dd1-4a4d-8c22-dbfb9134432e",
      "name": "Sticky Note19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        1104
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "df357cd7-5b94-4e8c-a92d-2d9193ff996a",
      "name": "Sticky Note20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        1568
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "301434a7-ad34-4353-8c80-cc20088faa1c",
      "name": "Sticky Note21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        976
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "28243790-72e7-4d5b-aca5-874656f8d28f",
      "name": "Sticky Note23",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        1488
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "4a998670-3a1e-4b28-8455-3dca5114db76",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1568,
        1136
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "c9c2f539-2480-443b-abaa-51a6702d8002",
      "name": "Stripe Data Collection",
      "type": "n8n-nodes-base.stripe",
      "position": [
        -1104,
        1360
      ]
    },
    {
      "id": "07376dc3-6cc0-4d66-9642-a014a71288a7",
      "name": "Filter – Successful Charges",
      "type": "n8n-nodes-base.filter",
      "position": [
        -896,
        1392
      ]
    },
    {
      "id": "c72504e0-b292-4a92-9a8f-27c58fe3f525",
      "name": "AI Agent  → Google Sheets Lookup",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        752,
        1248
      ]
    },
    {
      "id": "0e2b02cc-42da-464c-9d18-4423587bc95a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3184,
        1152
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "7e940abd-2bb0-495a-9f34-85705154e90b",
      "name": "Schedule Trigger Daily",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1328,
        1360
      ]
    },
    {
      "id": "b8b682e2-af1a-42cc-b373-cadcb5bf46eb",
      "name": "Merge Charge + PaymentIntent + Product",
      "type": "n8n-nodes-base.merge",
      "position": [
        16,
        1344
      ]
    },
    {
      "id": "63679dc6-60d4-4057-bd67-01d64787284e",
      "name": "Merge Logic Format Data",
      "type": "n8n-nodes-base.code",
      "position": [
        240,
        1360
      ]
    },
    {
      "id": "4a9a5f11-44f9-4d5a-b66c-68689384f15d",
      "name": "Check Required Fields",
      "type": "n8n-nodes-base.if",
      "position": [
        464,
        1360
      ]
    },
    {
      "id": "a5a425d6-8c3c-4a2d-a51d-bcfe75706097",
      "name": "Check Match Found",
      "type": "n8n-nodes-base.if",
      "position": [
        1152,
        1248
      ]
    },
    {
      "id": "f2983b5e-2896-4cd4-867a-04a328d4f797",
      "name": "Combine Stripe + Sheet Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        1376,
        1360
      ]
    },
    {
      "id": "533a5564-3e14-4c3f-9f1f-47b13141b6d9",
      "name": "Get row(s) in sheet – Purchase Sheet Lookup",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1600,
        1456
      ]
    },
    {
      "id": "8a9d79a9-e004-4fba-b4fa-f12dc5da1d6b",
      "name": "SQL Combine",
      "type": "n8n-nodes-base.merge",
      "position": [
        1824,
        1360
      ]
    },
    {
      "id": "06de9fee-3f8e-4941-ad12-ddf8f862b9ff",
      "name": "Check Automation Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        2048,
        1360
      ]
    },
    {
      "id": "92464fd8-4bda-4c18-a04d-543eb5fd3e72",
      "name": "Loop Over Items of New Purchases",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2272,
        1360
      ]
    },
    {
      "id": "64adf0d3-1460-4848-90ee-81684b24d7ef",
      "name": "AI Agent – Email Composer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2496,
        1248
      ]
    },
    {
      "id": "d5d8b09a-306f-4fe1-9773-182f9d62136e",
      "name": "Send a message (Gmail)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2848,
        1248
      ]
    },
    {
      "id": "1fa862b0-51be-4abb-ac4b-12a6a0ab4000",
      "name": "Append or update row in sheet  For  Tracking",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3072,
        1360
      ]
    }
  ],
  "connections": {
    "If1": {
      "main": [
        [
          {
            "node": "Get Product Details (from Payment Intent)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SQL Combine": {
      "main": [
        [
          {
            "node": "Check Automation Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Match Found": {
      "main": [
        [
          {
            "node": "Combine Stripe + Sheet Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customer matching": {
      "main": [
        [
          {
            "node": "SQL Combine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Required Fields": {
      "main": [
        [
          {
            "node": "AI Agent  → Google Sheets Lookup",
            "type": "main",
            "index": 0
          },
          {
            "node": "Combine Stripe + Sheet Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Schedule Trigger Daily": {
      "main": [
        [
          {
            "node": "Stripe Data Collection",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message (Gmail)": {
      "main": [
        [
          {
            "node": "Append or update row in sheet  For  Tracking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Stripe Data Collection": {
      "main": [
        [
          {
            "node": "Filter – Successful Charges",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent – Email Composer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check Automation Exists": {
      "main": [
        [
          {
            "node": "Loop Over Items of New Purchases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Logic Format Data": {
      "main": [
        [
          {
            "node": "Check Required Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent  → Google Sheets Lookup",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent – Email Composer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent  → Google Sheets Lookup",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent – Email Composer": {
      "main": [
        [
          {
            "node": "Send a message (Gmail)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Stripe + Sheet Data": {
      "main": [
        [
          {
            "node": "Customer matching",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get row(s) in sheet – Purchase Sheet Lookup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter – Successful Charges": {
      "main": [
        [
          {
            "node": "Get Payment Intent (From Charge)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Charge + PaymentIntent + Product",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get Payment Intent (From Charge)": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Charge + PaymentIntent + Product",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items of New Purchases": {
      "main": [
        [],
        [
          {
            "node": "AI Agent – Email Composer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent  → Google Sheets Lookup": {
      "main": [
        [
          {
            "node": "Check Match Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AI Agent  → Google Sheets Lookup",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Merge Charge + PaymentIntent + Product": {
      "main": [
        [
          {
            "node": "Merge Logic Format Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Product Details (from Payment Intent)": {
      "main": [
        [
          {
            "node": "Merge Charge + PaymentIntent + Product",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Append or update row in sheet  For  Tracking": {
      "main": [
        [
          {
            "node": "Loop Over Items of New Purchases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet – Purchase Sheet Lookup": {
      "main": [
        [
          {
            "node": "SQL Combine",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}