{
  "name": "Order Form Workflow",
  "nodes": [
    {
      "parameters": {
        "formTitle": "Order Form",
        "formDescription": "Italian restaurant order your food",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Customer Name",
              "requiredField": true
            },
            {
              "fieldLabel": "Email",
              "fieldType": "email",
              "requiredField": true
            },
            {
              "fieldLabel": "Item",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Magaritta Pizza"
                  },
                  {
                    "option": "Pepperoni Pizza"
                  },
                  {
                    "option": "Hawaiin Pizza"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "Quanitiy",
              "fieldType": "number",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.3,
      "position": [
        0,
        0
      ],
      "id": "db82bc98-d090-44c8-aafe-4b6c7a9f9ef7",
      "name": "On form submission",
      "webhookId": "9a36d584-3be8-4270-9c68-e55d79b2d4cc"
    },
    {
      "parameters": {
        "dataTableId": {
          "__rl": true,
          "value": "vMVfpMac0076uNe0",
          "mode": "list",
          "cachedResultName": "Pizza Orders",
          "cachedResultUrl": "/projects/VXTtZRW7FLbtceR1/datatables/vMVfpMac0076uNe0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "customerName": "={{ $json[\"Customer Name\"] }}",
            "email": "={{ $json.Email }}",
            "Item": "={{ $json.Item }}",
            "quantity": "={{ $json.Quanitiy }}",
            "Status": "Order Received"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "customerName",
              "displayName": "customerName",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "email",
              "displayName": "email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Item",
              "displayName": "Item",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "quantity",
              "displayName": "quantity",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1,
      "position": [
        176,
        0
      ],
      "id": "20217eea-c64e-495f-8e51-5a58bd5baf5a",
      "name": "Insert Order"
    },
    {
      "parameters": {
        "operation": "sendAndWait",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "C09L60TJMS7",
          "mode": "list",
          "cachedResultName": "orders"
        },
        "message": "=*New Order Received* :package:\n> *Order ID:* {{ $('Insert Order').item.json.id }}\n> *Customer Name:* {{ $('On form submission').item.json['Customer Name'] }}\n> *Item:* {{ $('On form submission').item.json.Item }}\n> *Quantity:* {{ $('On form submission').item.json.Quanitiy }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        0,
        224
      ],
      "id": "60051b3a-8c64-4e33-9e51-e917bc7e580d",
      "name": "Send message and wait for response",
      "webhookId": "7f2b1124-8846-4ddf-97c5-996c337c907e",
      "credentials": {
        "slackApi": {
          "id": "KMkFQmc4r1CU08xl",
          "name": "Slack account 2"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "dataTableId": {
          "__rl": true,
          "value": "vMVfpMac0076uNe0",
          "mode": "list",
          "cachedResultName": "Pizza Orders",
          "cachedResultUrl": "/projects/VXTtZRW7FLbtceR1/datatables/vMVfpMac0076uNe0"
        },
        "filters": {
          "conditions": [
            {
              "keyValue": "={{ $('Insert Order').item.json.id }}"
            }
          ]
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Status": "Preparing Order"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "customerName",
              "displayName": "customerName",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "email",
              "displayName": "email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Item",
              "displayName": "Item",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "quantity",
              "displayName": "quantity",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "readOnly": false,
              "removed": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1,
      "position": [
        208,
        224
      ],
      "id": "8c3aa916-69e3-4ac5-9a8e-9a62fde97abb",
      "name": "Update row(s)"
    },
    {
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "subject": "=Order Received #{{ $json.id }}",
        "emailType": "text",
        "message": "=Hi {{ $json.customerName }},\n\nWe have received your order for:\nItem: {{ $json.Item }}\nQuantity: {{ $json.quantity }}\n\nThanks, \nPizza Joint",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        368,
        0
      ],
      "id": "3e88464f-7224-4099-a59f-f711ec4839ea",
      "name": "Send a message",
      "webhookId": "86771527-2fa0-428c-950c-09013b1d5bb0",
      "credentials": {
        "gmailOAuth2": {
          "id": "xmp6P6qtAw4JgOCe",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "subject": "=Preparing Order #{{ $json.id }}",
        "emailType": "text",
        "message": "=Hi {{ $json.customerName }},\n\nWe're currently preparing your order for:\nItem: {{ $json.Item }}\nQuantity: {{ $json.quantity }}\n\nWe'll let you know as soon as it's ready!\n\nThanks,\nPizza Joint",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        416,
        224
      ],
      "id": "6982c3a2-651e-4c87-8562-dd75bc7dae6e",
      "name": "Send a Preparing Order Message",
      "webhookId": "86771527-2fa0-428c-950c-09013b1d5bb0",
      "credentials": {
        "gmailOAuth2": {
          "id": "xmp6P6qtAw4JgOCe",
          "name": "Gmail account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "On form submission": {
      "main": [
        [
          {
            "node": "Insert Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert Order": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send message and wait for response": {
      "main": [
        [
          {
            "node": "Update row(s)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row(s)": {
      "main": [
        [
          {
            "node": "Send a Preparing Order Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        [
          {
            "node": "Send message and wait for response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "db466fe8-8ef5-4a6a-8312-351e5aa3ef66",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "4aabc0aa2e160dafa4f9d9bcedde563b5af29598cd16960f637ae2fb99aea720"
  },
  "id": "A2dd0KwbEGpywtco",
  "tags": []
}