{
  "name": "Automatic Typebot flows two-way sync with GitHub using Typebot API",
  "nodes": [
    {
      "id": "e770fbf4-8c4f-4aaa-b722-3140ecec28f2",
      "name": "On clicking 'execute'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        360,
        640
      ]
    },
    {
      "id": "49b53bc4-6441-4577-a851-bb7f2c580a39",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        480
      ],
      "parameters": {
        "width": 371,
        "height": 601,
        "content": "## Typebot Backup to GitHub \nThis workflow will backup all instance typebots to GitHub and also deleted it if was deleted in your typebot workspace.\n\nThe files are saved `ID.json` for the filename.\n\n#"
      }
    },
    {
      "id": "7dede05f-8c5a-426e-a822-d21b7e50d976",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -140,
        1620
      ]
    },
    {
      "id": "7469a576-e3ea-4e55-93f3-7f380f1a57e7",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        480
      ],
      "parameters": {
        "width": 1831,
        "height": 601,
        "content": "## Main workflow loop"
      }
    },
    {
      "id": "acb81c9e-152a-4bf3-ab23-1eb66e8d5510",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        1100
      ],
      "parameters": {
        "width": 2231,
        "height": 941,
        "content": "## Subworkflow"
      }
    },
    {
      "id": "6df6e830-5721-421f-9b46-f99f9164eb4d",
      "name": "List Typebots",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        740
      ]
    },
    {
      "id": "3d44e0b2-c404-424a-8eba-7ec111738939",
      "name": "typebot",
      "type": "n8n-nodes-base.set",
      "position": [
        1240,
        640
      ]
    },
    {
      "id": "4be16d80-43fd-4cc1-b79c-11fec3c76829",
      "name": "Get Typebot",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        300,
        1360
      ]
    },
    {
      "id": "952f2ff9-0421-4239-947d-3d8f0b7925fd",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1020,
        640
      ]
    },
    {
      "id": "ef97c1ec-d175-44b7-a462-2c8c2a8221ad",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        520,
        1460
      ]
    },
    {
      "id": "ef0cd866-afcd-41b9-8fad-15d79a88041e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        600
      ],
      "parameters": {
        "width": 150,
        "height": 80,
        "content": "## Edit this node 👇"
      }
    },
    {
      "id": "e68821d5-11ea-4324-9957-303433a8aad7",
      "name": "Globals",
      "type": "n8n-nodes-base.set",
      "position": [
        580,
        740
      ]
    },
    {
      "id": "3027c8bd-a477-4f47-a2a9-fd952d9f9698",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        360,
        840
      ]
    },
    {
      "id": "caff32a5-6d82-43c9-998c-3258342d66b3",
      "name": "github",
      "type": "n8n-nodes-base.set",
      "position": [
        1240,
        840
      ]
    },
    {
      "id": "4333f695-81d9-4c87-8d68-9a6245dc12d5",
      "name": "List files",
      "type": "n8n-nodes-base.github",
      "position": [
        1020,
        840
      ]
    },
    {
      "id": "7eab3efa-c3e0-420a-9fb8-9cd9ff52f90e",
      "name": "Get file data",
      "type": "n8n-nodes-base.github",
      "position": [
        520,
        1260
      ]
    },
    {
      "id": "5e01d7b1-c09d-494f-8df1-c241db278084",
      "name": "Create new file",
      "type": "n8n-nodes-base.github",
      "position": [
        1620,
        1160
      ]
    },
    {
      "id": "4b8b16d4-5363-4f08-b8b5-deac7f4250f3",
      "name": "Edit existing file",
      "type": "n8n-nodes-base.github",
      "position": [
        1620,
        1360
      ]
    },
    {
      "id": "c2cb20ab-07e5-41a3-8f7d-ed6474977226",
      "name": "Return",
      "type": "n8n-nodes-base.set",
      "position": [
        1840,
        1560
      ]
    },
    {
      "id": "7ce14355-b3b9-4cd0-a09e-6d91bfe6bfcc",
      "name": "Delete a file",
      "type": "n8n-nodes-base.github",
      "position": [
        1620,
        1860
      ]
    },
    {
      "id": "c2252937-414f-446c-a2b1-96eef623f57e",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        1400,
        1780
      ]
    },
    {
      "id": "10146994-a24f-4d9e-955d-f3e76f4abae0",
      "name": "isDeleted",
      "type": "n8n-nodes-base.code",
      "position": [
        1180,
        1780
      ]
    },
    {
      "id": "d692e133-5184-4753-bbab-751f9903b1cb",
      "name": "isDiffOrNew",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        1360
      ]
    },
    {
      "id": "bcafd96c-6fd4-44ce-b975-33c7cf2dff84",
      "name": "Check Status",
      "type": "n8n-nodes-base.switch",
      "position": [
        1180,
        1360
      ]
    },
    {
      "id": "aaf2d938-ec55-4152-9e34-a2e2e6769760",
      "name": "File is different",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1400,
        1360
      ]
    },
    {
      "id": "f2759b0f-3ec3-434f-acfe-36c10ebb35bb",
      "name": "File is new",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1400,
        1160
      ]
    },
    {
      "id": "785fff83-40c4-4d38-9300-369e68779412",
      "name": "File is same",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1400,
        1560
      ]
    },
    {
      "id": "54804b0b-0001-4a41-afb5-12c0c6cf653c",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        740,
        1360
      ]
    },
    {
      "id": "b9cb042f-d767-4c2a-86f8-5d567d23c32a",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        80,
        1620
      ]
    },
    {
      "id": "eb4adeea-418b-4d2d-a8ce-36739c195d7e",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1460,
        740
      ]
    },
    {
      "id": "58fb33e4-520e-4a58-b3ea-acdb5ef02208",
      "name": "Execute Workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        1680,
        740
      ]
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Delete a file",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "isDiffOrNew",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Get Typebot",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "isDeleted",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "github": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Globals": {
      "main": [
        [
          {
            "node": "List Typebots",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "typebot": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "typebot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "isDeleted": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List files": {
      "main": [
        [
          {
            "node": "github",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "File is new": {
      "main": [
        [
          {
            "node": "Create new file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Typebot": {
      "main": [
        [
          {
            "node": "Get file data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "isDiffOrNew": {
      "main": [
        [
          {
            "node": "Check Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Status": {
      "main": [
        [
          {
            "node": "File is new",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "File is different",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "File is same",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File is same": {
      "main": [
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete a file": {
      "main": [
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get file data": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Typebots": {
      "main": [
        [
          {
            "node": "List files",
            "type": "main",
            "index": 0
          },
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create new file": {
      "main": [
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Globals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File is different": {
      "main": [
        [
          {
            "node": "Edit existing file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit existing file": {
      "main": [
        [
          {
            "node": "Return",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On clicking 'execute'": {
      "main": [
        [
          {
            "node": "Globals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}