{
  "name": "Unique QRcode coupon assignment and validation for lead generation with SuiteCRM",
  "nodes": [
    {
      "id": "5ef4dd1d-39d6-487e-a48d-420b458ac1ee",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -420,
        340
      ]
    },
    {
      "id": "a7102d60-d4bd-450d-92b3-a32e2304b4a9",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        40,
        340
      ]
    },
    {
      "id": "f9dfd28e-42b5-488a-acde-dbbff95cf72f",
      "name": "Token SuiteCRM",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        700,
        -320
      ]
    },
    {
      "id": "0e5c7208-a90a-4612-a5eb-f962546320dc",
      "name": "Create Lead SuiteCRM",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        940,
        -320
      ]
    },
    {
      "id": "e9191ab8-4fb8-40bb-b676-89ac4e58b2dc",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -420,
        -420
      ]
    },
    {
      "id": "4f61d7df-aeb3-4e8d-b30b-8396944e93a3",
      "name": "Duplicate Lead?",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        20,
        -420
      ]
    },
    {
      "id": "393372b3-3aaf-4500-a795-0c0f47ea9625",
      "name": "Form Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -180,
        -420
      ]
    },
    {
      "id": "40d47841-6fb6-4339-b101-a8e917791229",
      "name": "Get Coupon",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        480,
        -320
      ]
    },
    {
      "id": "16358f58-eb7c-4fe5-a0aa-960943a7bebd",
      "name": "Update Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1180,
        -320
      ]
    },
    {
      "id": "36025b8c-41cb-4827-bf0e-ec6f692c13df",
      "name": "Is Duplicate?",
      "type": "n8n-nodes-base.if",
      "position": [
        220,
        -420
      ]
    },
    {
      "id": "e2267b93-9396-4ebf-8307-f8c98c1c3d65",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        -500
      ],
      "parameters": {
        "width": 340,
        "height": 240,
        "content": "Check if the lead has already received the coupon"
      }
    },
    {
      "id": "a8af825a-4e26-4660-8a9e-f7ce3ba33b3a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        -380
      ],
      "parameters": {
        "width": 180,
        "height": 220,
        "content": "Find the first available unassigned coupon"
      }
    },
    {
      "id": "dd868852-5b0f-4b5b-922f-f70b8a6da01e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -380
      ],
      "parameters": {
        "width": 400,
        "height": 220,
        "content": "Enter the lead with the relative coupon on Suite CRM. Change SUITECRMURL, CLIENTSECRET and CLIENTID"
      }
    },
    {
      "id": "d2c26f3a-496e-47d6-b3f6-1aea5d0293fa",
      "name": "Get QR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1400,
        -320
      ]
    },
    {
      "id": "371fa5e5-6f91-4236-83d4-81f579d7d2ab",
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1620,
        -320
      ]
    },
    {
      "id": "5893bd1d-762d-4337-8392-6d358002845a",
      "name": "Update Lead",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1020,
        100
      ]
    },
    {
      "id": "fd0a43f4-a3f1-4008-947c-f8208d2126f7",
      "name": "Not used?",
      "type": "n8n-nodes-base.if",
      "position": [
        540,
        240
      ]
    },
    {
      "id": "0029c366-aec1-4305-aab5-2ab6845e2828",
      "name": "Coupon OK",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1480,
        100
      ]
    },
    {
      "id": "4c326412-0965-4f1c-9b77-2704d37a7151",
      "name": "No coupon",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        320,
        460
      ]
    },
    {
      "id": "e18cf9e7-584d-4f49-88b8-4c3a513ff613",
      "name": "Coupon KO",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        800,
        320
      ]
    },
    {
      "id": "55a63a65-5472-4e50-8150-604c6bc9dd18",
      "name": "Token SuiteCRM 1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        100
      ]
    },
    {
      "id": "c843c9f2-9940-423c-bc9d-8530fb43f229",
      "name": "Set coupon",
      "type": "n8n-nodes-base.set",
      "position": [
        -180,
        340
      ]
    },
    {
      "id": "9a2d877d-9016-460e-b376-ea27c59a492a",
      "name": "Get Lead",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        320,
        240
      ]
    },
    {
      "id": "da2e62e5-898c-4024-8d85-517b18dcefc3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        280
      ],
      "parameters": {
        "width": 360,
        "height": 220,
        "content": "Check if the QR code scan is valid"
      }
    },
    {
      "id": "507dc2ab-a762-49b8-a13a-c9b20c7135d8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        180
      ],
      "parameters": {
        "width": 360,
        "height": 220,
        "content": "Check if coupon is valid"
      }
    },
    {
      "id": "f44b5645-1611-4c16-83ac-ee8a4821970b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        40
      ],
      "parameters": {
        "width": 420,
        "height": 220,
        "content": "Enter the lead with the relative coupon on Suite CRM. Change SUITECRMURL, CLIENTSECRET and CLIENTID"
      }
    },
    {
      "id": "ad0a5999-2616-4c7b-8108-6f13e573490b",
      "name": "Update coupon used",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1240,
        100
      ]
    },
    {
      "id": "acd6a7fb-aeae-4baf-8f60-af16715a6de6",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1560,
        -380
      ],
      "parameters": {
        "width": 220,
        "height": 220,
        "content": "Set the Webhook URL"
      }
    },
    {
      "id": "091a00b6-34bd-4221-b2f1-4d55719a273a",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -900
      ],
      "parameters": {
        "width": 680,
        "height": 240,
        "content": "## Coupon assignment and simple validation system\n\nThis workflow is designed to manage the assignment and validation of unique QR code coupons within a lead generation system. The process begins with "
      }
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Get Lead",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No coupon",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get QR": {
      "main": [
        [
          {
            "node": "Send Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Set coupon",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Lead": {
      "main": [
        [
          {
            "node": "Not used?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Not used?": {
      "main": [
        [
          {
            "node": "Token SuiteCRM 1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Coupon KO",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Coupon": {
      "main": [
        [
          {
            "node": "Token SuiteCRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set coupon": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Form Fields": {
      "main": [
        [
          {
            "node": "Duplicate Lead?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Lead": {
      "main": [
        [
          {
            "node": "Update coupon used",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Sheet": {
      "main": [
        [
          {
            "node": "Get QR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Duplicate?": {
      "main": [
        [],
        [
          {
            "node": "Get Coupon",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Token SuiteCRM": {
      "main": [
        [
          {
            "node": "Create Lead SuiteCRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Duplicate Lead?": {
      "main": [
        [
          {
            "node": "Is Duplicate?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Token SuiteCRM 1": {
      "main": [
        [
          {
            "node": "Update Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Form Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update coupon used": {
      "main": [
        [
          {
            "node": "Coupon OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Lead SuiteCRM": {
      "main": [
        [
          {
            "node": "Update Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}