{
  "id": "txiPX7aqzHQNS8uq",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "ZapMail Delivery",
  "tags": [],
  "nodes": [
    {
      "id": "80f03ea4-fff7-451c-9372-e13aa340e66d",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -720,
        256
      ],
      "parameters": {
        "path": "eb4f5f26-4107-4634-9e74-93fc5abc0abd",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "c95d0d7e-4464-48f3-a152-cacaca29373b",
      "name": "Crypto",
      "type": "n8n-nodes-base.crypto",
      "position": [
        -512,
        256
      ],
      "parameters": {
        "type": "SHA256",
        "value": "={{ JSON.stringify($json.body) }}",
        "action": "hmac",
        "secret": "YOUR_CREDENTIAL_HERE"
      },
      "typeVersion": 1
    },
    {
      "id": "8c734876-e09e-40a6-88c4-68eb9f93bd1d",
      "name": "Is Signature Valid?",
      "type": "n8n-nodes-base.if",
      "position": [
        -304,
        256
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "9a072fb4-3f4b-49d5-a4f3-db43b0b93214",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data }}",
              "rightValue": "={{ $json.headers[\"x-razorpay-signature\"] }}"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "8df4030e-e937-4538-b4c6-b9ccae2d50be",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -16,
        240
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Product 1",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "df745781-fe34-4bda-b1a0-87e9ed9f6852",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.payload.payment.entity.notes.template_name }}",
                    "rightValue": "Product 1"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Product 2",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "bbf3297a-3cc9-43db-b1c6-4c52c72a502e",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.payload.payment.entity.notes.template_name }}",
                    "rightValue": "Product 2"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Product 3",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "d9972d1a-8f59-4d93-8cc2-08326728bf5e",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.payload.payment.entity.notes.template_name }}",
                    "rightValue": "Product 3"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Product 4",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "04490b5d-9b34-4c39-ab37-7b922c3c3e50",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.payload.payment.entity.notes.template_name }}",
                    "rightValue": "Product 4"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Product 5",
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b53ce8ff-a17d-44ca-8314-47ef3330aaef",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.body.payload.payment.entity.notes.template_name }}",
                    "rightValue": "Product 5"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "7c5a92f6-43f8-4b90-926c-c89aa8837180",
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        640,
        224
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "6cb580ad-25ee-4fef-8872-a801f45623bf",
      "name": "Search files and folders",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        416,
        224
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "list",
            "value": "1OZ9ZiJFPAmDujlpHW1Z-nji-eEtxfdeB",
            "cachedResultUrl": "https://drive.google.com/drive/folders/1OZ9ZiJFPAmDujlpHW1Z-nji-eEtxfdeB",
            "cachedResultName": "Paid n8n Templates"
          }
        },
        "options": {},
        "resource": "fileFolder",
        "queryString": "={{ $json.body.payload.payment.entity.notes.template_name }}"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "27d2b5d8-c893-4c20-9a17-ea15a73431da",
      "name": "Send email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        960,
        224
      ],
      "parameters": {
        "html": "=html\n<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"utf-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <style>\n    body {\n      font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n      background-color: #f4f7f9;\n      margin: 0;\n      padding: 0;\n      -webkit-font-smoothing: antialiased;\n    }\n\n    .container {\n      max-width: 600px;\n      margin: 30px auto;\n      background-color: #ffffff;\n      border-radius: 12px;\n      overflow: hidden;\n      border: 1px solid #e5e7eb;\n    }\n\n    .header {\n      padding: 40px 30px;\n      text-align: center;\n      border-bottom: 1px solid #f1f5f9;\n    }\n\n    .header h1 {\n      margin: 0;\n      font-size: 28px;\n      color: #111827;\n      font-weight: 700;\n    }\n\n    .header p {\n      margin-top: 10px;\n      color: #6b7280;\n      font-size: 15px;\n    }\n\n    .content {\n      padding: 40px 35px;\n      color: #374151;\n      line-height: 1.7;\n    }\n\n    .greeting {\n      font-size: 22px;\n      font-weight: 700;\n      color: #111827;\n      margin-bottom: 20px;\n    }\n\n    .hero-section {\n      background: #f8fafc;\n      border-radius: 12px;\n      padding: 25px;\n      margin: 30px 0;\n      text-align: center;\n    }\n\n    .hero-section img {\n      max-width: 220px;\n      height: auto;\n      margin-bottom: 15px;\n    }\n\n    .product-name {\n      font-size: 18px;\n      font-weight: 700;\n      color: #2563eb;\n      margin: 0;\n    }\n\n    .instructions-title {\n      margin-top: 35px;\n      margin-bottom: 25px;\n      font-size: 18px;\n      font-weight: 700;\n      color: #111827;\n    }\n\n    .step {\n      display: flex;\n      align-items: flex-start;\n      margin-bottom: 18px;\n    }\n\n    .step-number {\n      min-width: 34px;\n      height: 34px;\n      line-height: 34px;\n      text-align: center;\n      background: #eff6ff;\n      color: #2563eb;\n      border-radius: 8px;\n      font-weight: bold;\n      margin-right: 14px;\n      font-size: 14px;\n    }\n\n    .support-box {\n      margin-top: 35px;\n      padding-top: 25px;\n      border-top: 1px solid #e5e7eb;\n      text-align: center;\n      color: #6b7280;\n      font-size: 14px;\n    }\n\n    .footer {\n      background: #f8fafc;\n      padding: 18px;\n      text-align: center;\n      font-size: 12px;\n      color: #9ca3af;\n    }\n\n    .footer a {\n      color: #9ca3af;\n      text-decoration: none;\n    }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n\n    <div class=\"header\">\n      <h1>Your Purchase Is Ready</h1>\n      <p>Thank you for your order.</p>\n    </div>\n\n    <div class=\"content\">\n\n      <div class=\"greeting\">\n        Hi {{ $node[\"Webhook\"].json.body.payload.payment.entity.notes.name }},\n      </div>\n\n      <p>\n        Thank you for your purchase. Your digital download is attached to this email and is ready to use.\n      </p>\n\n      <div class=\"hero-section\">\n        <img src=\"https://i.ibb.co/0RxF9WrP/image.png\" alt=\"Digital Download\">\n        <p class=\"product-name\">\n          {{ $node[\"Webhook\"].json.body.payload.payment.entity.notes.template_name }}\n        </p>\n      </div>\n\n      <div class=\"instructions-title\">\n        Getting Started\n      </div>\n\n      <div class=\"step\">\n        <div class=\"step-number\">1</div>\n        <div>Download the attached file.</div>\n      </div>\n\n      <div class=\"step\">\n        <div class=\"step-number\">2</div>\n        <div>Follow the included setup instructions or import the file into your preferred platform.</div>\n      </div>\n\n      <div class=\"step\">\n        <div class=\"step-number\">3</div>\n        <div>Customize the template as needed and start using it immediately.</div>\n      </div>\n\n      <div class=\"support-box\">\n        If you have any questions, simply reply to this email and we'll be happy to help.\n      </div>\n\n    </div>\n\n    <div class=\"footer\">\n      Powered by Blukaze\n    </div>\n\n  </div>\n</body>\n</html>",
        "options": {
          "attachments": "data",
          "appendAttribution": false
        },
        "subject": "=Your {{ $node[\"Webhook\"].json.body.payload.payment.entity.notes.template_name }} digital delivery",
        "toEmail": "={{ $('Is Signature Valid?').item.json.body.payload.payment.entity.email }}",
        "fromEmail": "user@example.com"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 2.1
    },
    {
      "id": "dce9b799-acaa-4a3d-a39b-cd0ccab14f1c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        80
      ],
      "parameters": {
        "width": 480,
        "height": 704,
        "content": "# ZapMail Delivery\nAutomate digital product fulfillment using n8n, Razorpay, Google Drive, and Email.\n\nZapMail Delivery automatically delivers digital products to customers after a successful payment. Once a payment is verified, the workflow identifies the purchased product, retrieves it from Google Drive, and sends it directly to the customer's inbox.\n\n## Features\n* Automatic payment verification\n* Secure Razorpay webhook validation\n* Multi-product support\n* Google Drive file storage\n* Automatic email delivery\n* No coding required\n* Easy to scale with additional products\n\n## How It Works\n1. Customer completes payment through Razorpay.\n2. Razorpay sends a webhook to n8n.\n3. The payment signature is verified.\n4. The purchased product is identified.\n5. The product file is downloaded from Google Drive.\n6. The product is delivered via email.\n\n---\n\n### Need a custom automation?\nVisit Blukaze.com\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c2ce5906-540c-4a73-bc79-297d9b440180",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -736,
        112
      ],
      "parameters": {
        "color": 3,
        "width": 576,
        "height": 608,
        "content": "# Payment Verification\nThis section receives incoming Razorpay webhook events and verifies that the request genuinely originated from Razorpay.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n- **Webhook** \u2014 Receives payment success events.\n- **Crypto (HMAC)** \u2014 Generates a signature using the webhook secret.\n- **Is Signature Valid?** \u2014 Compares generated and received signatures.\n\n## User Action Required\n1. Create a Razorpay Payment Page.\n2. Configure a Razorpay Webhook.\n3. Copy the webhook URL from n8n.\n4. Add your Razorpay Webhook Secret.\n5. Update the secret inside the Crypto node.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "47791617-8830-4eda-af3d-75c60ac0aa98",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        112
      ],
      "parameters": {
        "color": 3,
        "width": 352,
        "height": 608,
        "content": "# Product Routing\nThis section determines which digital product should be delivered based on the product selected during checkout.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## User Action Required\n1. Create a Google Drive folder for each product.\n2. Upload the corresponding product files.\n3. Add a new Switch rule for every product.\n4. Ensure the product name matches the value sent from Razorpay.\n\n### Example Products\n* Product 1 * Product 2 * Product 3 * Product 4 * Product 5\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5a548fbb-21ab-413c-9df0-e42f9acc46ed",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        112
      ],
      "parameters": {
        "color": 3,
        "width": 432,
        "height": 496,
        "content": "# Product Delivery\nThis section retrieves the purchased product from Google Drive and delivers it to the customer's inbox.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n* **Search Files and Folders** \u2014 Finds the purchased product.\n* **Download File** \u2014 Downloads the product file.\n\n## User Action Required\n1. Connect your Google Drive account.\n2. Upload your digital products to Google Drive.\n3. Update the folder and file references if needed.\n4. Test the workflow using a successful payment event.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7dce7c6f-2b7e-4fe3-aebc-41cb27fb9e16",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 352,
        "height": 496,
        "content": "# Customer Delivery\nThis section completes the fulfillment process by delivering the purchased product directly to the customer's inbox.\n\n\n\n\n\n\n\n\n\n\n\n- **Send Email** \u2014 Sends a branded delivery email with the purchased product attached.\n\n## User Action Required\n1. Connect your email provider credentials.\n2. Customize the email template and branding.\n3. Update the sender email address.\n4. Add your support contact information.\n5. Test delivery using a successful payment event."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "RsKuDS9Jp3nyxV5d9cAYP",
    "timeSavedMode": "fixed",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "49fde6f0-c8a0-4981-937a-62fe52655b29",
  "connections": {
    "Crypto": {
      "main": [
        [
          {
            "node": "Is Signature Valid?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Search files and folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Send email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Signature Valid?": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search files and folders": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}