{
  "name": "Jotform automated commerce sync: Telegram confirmation & Zoho invoice",
  "nodes": [
    {
      "id": "5dbd71ce-486c-4abd-9264-8f3d9169d03e",
      "name": "JotForm Trigger",
      "type": "n8n-nodes-base.jotFormTrigger",
      "position": [
        -192,
        -176
      ]
    },
    {
      "id": "63b71df6-f37c-407d-a022-19733284d757",
      "name": "Send a text message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2560,
        -208
      ]
    },
    {
      "id": "babe8a4d-af6b-49c4-859b-4575238b3e7f",
      "name": "Get ChatId Row(s)",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1392,
        -192
      ]
    },
    {
      "id": "691a0fd1-73f5-45b2-b0f7-25a02474de85",
      "name": "Set ChatId and Products",
      "type": "n8n-nodes-base.set",
      "position": [
        1984,
        -208
      ]
    },
    {
      "id": "654f6d89-8281-4b83-a95f-88d16a40e178",
      "name": "Organize & Generate Order ID",
      "type": "n8n-nodes-base.code",
      "position": [
        16,
        -176
      ]
    },
    {
      "id": "8428985f-6c14-4918-b19e-ff604da17b66",
      "name": "If ChatId Found",
      "type": "n8n-nodes-base.if",
      "position": [
        1632,
        -192
      ]
    },
    {
      "id": "32633847-dcf7-4307-a613-f1a23e3e05b1",
      "name": "Append/Update CRM Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2000,
        -464
      ]
    },
    {
      "id": "420c37a1-cf4c-4af1-a565-218016fca586",
      "name": "Create Zoho Invoice",
      "type": "n8n-nodes-base.zohoCrm",
      "position": [
        2288,
        -208
      ]
    },
    {
      "id": "919827cc-6c70-4d27-a5f5-c0a0aebc5730",
      "name": "Telegram Trigger (Get ChatId)",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -176,
        -432
      ]
    },
    {
      "id": "c7810f3b-da2a-4dcb-a63e-f02e2c294e04",
      "name": "Insert Order Data",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        224,
        -176
      ]
    },
    {
      "id": "8bca615b-5157-4641-ab95-af3548c27293",
      "name": "Get Empty ChatId Rows",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        32,
        -432
      ]
    },
    {
      "id": "856d1f24-6ea8-419f-b974-88517c06d333",
      "name": "Update ChatId",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        288,
        -432
      ]
    },
    {
      "id": "e9796f5f-1c75-4db1-8b23-07d36a805221",
      "name": "Get Order Row to Check ChatId",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        624,
        -176
      ]
    },
    {
      "id": "3cfda48d-d552-4f64-8305-6fddbbf1d4be",
      "name": "Mark as Waited",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1120,
        48
      ]
    },
    {
      "id": "fd53acd6-7699-421a-84cd-18ce3dd9a6be",
      "name": "Switch (ChatId Check)",
      "type": "n8n-nodes-base.switch",
      "position": [
        1104,
        -176
      ]
    },
    {
      "id": "3306d51c-b1c8-4f36-8648-6701a69b78b9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        -256
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "Starts the workflow when a new order form is submitted on JotForm."
      }
    },
    {
      "id": "259d41a0-48a4-4a37-99a0-352e2ca08ad3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -256
      ],
      "parameters": {
        "width": 192,
        "height": null,
        "content": "Parses the form data, structures it, and creates a unique order ID."
      }
    },
    {
      "id": "d2312f79-9ca4-4c73-8f6c-4df71acec6d6",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -256
      ],
      "parameters": {
        "width": 192,
        "height": null,
        "content": "Saves the order details into an n8n Data Table to track its status and Chat ID."
      }
    },
    {
      "id": "138ef5db-e274-43a6-8665-327c3a2cd047",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        -496
      ],
      "parameters": {
        "width": 256,
        "height": null,
        "content": "An independent trigger waiting for any message from a customer to the bot to capture their Chat ID."
      }
    },
    {
      "id": "dbb6be07-f740-402a-bd36-2f9187d107ea",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -496
      ],
      "parameters": {
        "width": 208,
        "height": null,
        "content": "Finds orders in the Data Table that are waiting for a customer's Chat ID."
      }
    },
    {
      "id": "5b18035f-c415-4000-9e5c-c2f0d9397745",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -496
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "Uses the Chat ID from the new Telegram message to update the corresponding pending order row."
      }
    },
    {
      "id": "41d16d68-1e62-47ef-b6aa-8f0697e87672",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        528,
        -256
      ],
      "parameters": {
        "width": 272,
        "height": null,
        "content": " Checks the Data Table immediately after insertion to see if the customer's Chat ID is already available."
      }
    },
    {
      "id": "e1c89c28-44b8-4357-8c8f-fda555564cfc",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        -256
      ],
      "parameters": {
        "width": 256,
        "height": 176,
        "content": " Directs the flow to proceed if the Chat ID is found or to wait if it is still missing."
      }
    },
    {
      "id": "5f1d726b-3db7-4625-a05f-c87f5000174c",
      "name": "Wait 5 Minutes",
      "type": "n8n-nodes-base.wait",
      "position": [
        832,
        48
      ]
    },
    {
      "id": "826077be-7a44-48b1-b23d-9061199fc290",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        96
      ],
      "parameters": {
        "width": 288,
        "height": null,
        "content": ".\n\n\n\n\nPauses the workflow briefly to allow a customer time to message the Telegram bot."
      }
    },
    {
      "id": "cb339e04-fdbd-458b-841a-f295c7802f9a",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        96
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "\n.\n\n\n\n\nUpdates the Data Table record to prevent the workflow from entering a perpetual wait loop."
      }
    },
    {
      "id": "d8c50d9c-f33b-4490-b25f-b7862d65dd4c",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        -256
      ],
      "parameters": {
        "width": null,
        "height": 176,
        "content": "Fetches the final, complete order data row, including the confirmed Chat ID."
      }
    },
    {
      "id": "bd70e237-75a9-4bdc-80ef-760a1c027c47",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        -272
      ],
      "parameters": {
        "width": null,
        "height": 176,
        "content": "Formats the Chat ID and product list into an easy-to-use structure for the final message."
      }
    },
    {
      "id": "5fb92642-5c3d-48c0-8ab8-deb3fef8c264",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        -544
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "Logs the complete order information into a designated Google Sheet (CRM)."
      }
    },
    {
      "id": "36ff95d6-b3b4-4388-90f3-95e87e3cb629",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2208,
        -272
      ],
      "parameters": {
        "width": null,
        "height": 176,
        "content": "Automatically generates an invoice for the new order within Zoho CRM.\n\n"
      }
    },
    {
      "id": "3362d046-225e-4efa-8ea9-3227d35c82f6",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2480,
        -272
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "Sends the final, templated order confirmation message to the customer via Telegram."
      }
    },
    {
      "id": "0a61c4b5-13fa-476f-a00d-ca693ec60760",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        -1056
      ],
      "parameters": {
        "width": 1024,
        "height": 736,
        "content": "# JotForm Setup Guide\n\n\n## ⚡ Step 1: Link with the Webhook\n\n\n* **1. Log in to your JotForm account, select your Form, and navigate to Settings.**\n\n* **2. Go to Integrations and search for Webhooks.**\n"
      }
    }
  ],
  "connections": {
    "Mark as Waited": {
      "main": [
        [
          {
            "node": "Get Order Row to Check ChatId",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 5 Minutes": {
      "main": [
        [
          {
            "node": "Mark as Waited",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If ChatId Found": {
      "main": [
        [
          {
            "node": "Set ChatId and Products",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JotForm Trigger": {
      "main": [
        [
          {
            "node": "Organize & Generate Order ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get ChatId Row(s)": {
      "main": [
        [
          {
            "node": "If ChatId Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert Order Data": {
      "main": [
        [
          {
            "node": "Get Order Row to Check ChatId",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Zoho Invoice": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Empty ChatId Rows": {
      "main": [
        [
          {
            "node": "Update ChatId",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch (ChatId Check)": {
      "main": [
        [
          {
            "node": "Get ChatId Row(s)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 5 Minutes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set ChatId and Products": {
      "main": [
        [
          {
            "node": "Create Zoho Invoice",
            "type": "main",
            "index": 0
          },
          {
            "node": "Append/Update CRM Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Organize & Generate Order ID": {
      "main": [
        [
          {
            "node": "Insert Order Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Order Row to Check ChatId": {
      "main": [
        [
          {
            "node": "Switch (ChatId Check)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger (Get ChatId)": {
      "main": [
        [
          {
            "node": "Get Empty ChatId Rows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}