GPT-4oを基にしたレストラン注文チャットボット(POS連携)

上級

これはSales, Support, AI分野の自動化ワークフローで、19個のノードを含みます。主にIf, Code, GoogleSheets, SplitInBatches, Agentなどのノードを使用、AI技術を活用したスマート自動化を実現。 GPT-4oを基にしたレストラン注文チャットボットで、POSシステムとの連携をサポート

前提条件
  • Google Sheets API認証情報
  • OpenAI API Key
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "d73282515b90623d4a8783919a2d772c706425d649e1512792f37ac51e07e4a8"
  },
  "nodes": [
    {
      "id": "62b3c7cb-1993-44f1-8b86-38a34ca1d029",
      "name": "情報抽出器",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -200,
        500
      ],
      "parameters": {
        "text": "={{ $json.query }}",
        "options": {},
        "schemaType": "fromJson",
        "jsonSchemaExample": "{\n  \"name\": \"Information Extractor\",\n  \"type\": \"n8n-nodes-base.informationExtractor\",\n  \"parameters\": {\n    \"extract\": [\n      {\n        \"name\": \"items\",\n        \"pattern\": \"(latte|coffee|tea|cappuccino)\"\n      },\n      {\n        \"name\": \"quantity\",\n        \"pattern\": \"\\\\d+\"\n      },\n      {\n        \"name\": \"table\",\n        \"pattern\": \"table number (\\\\d+)\"\n      }\n    ]\n  }\n}\n"
      },
      "typeVersion": 1
    },
    {
      "id": "75883f27-af58-4791-9e1a-a70b83e1cead",
      "name": "OpenAI チャットモデル1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -180,
        740
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "OizdHUANhz9NIHyd",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "aeefdd4b-bf7d-4824-97d8-0afc356fb7d6",
      "name": "条件分岐",
      "type": "n8n-nodes-base.if",
      "position": [
        120,
        540
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8a5dda0c-a567-4305-83a3-68d6fb573dd3",
              "operator": {
                "type": "array",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.output.parameters.extract }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "9e3f8a1b-ccd8-4f4d-91cb-b99cc46f412f",
      "name": "Google スプレッドシート",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        840,
        420
      ],
      "parameters": {
        "columns": {
          "value": {
            "Item": "={{ $json.item }}",
            "Quantity": "={{ $json.quantity }}",
            "Table No": "={{ $json.table }}",
            "Timestamp": "={{ $now }}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Table No",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Table No",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Item",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Item",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Quantity",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Quantity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/16fXaxEcfnq_-oif9tp94-3uTeHSFWoSnuBPNTljuW-k/edit#gid=0",
          "cachedResultName": "Order log"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/16fXaxEcfnq_-oif9tp94-3uTeHSFWoSnuBPNTljuW-k/edit?usp=sharing"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "0RSJGMBcFzxY9GkS",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "4cc1818f-1585-42e1-a111-7b55557aebcb",
      "name": "コード",
      "type": "n8n-nodes-base.code",
      "position": [
        380,
        560
      ],
      "parameters": {
        "language": "python",
        "pythonCode": "# Input from n8n\ninput_data = items\n\n# Get the extracted list\nextract_data = input_data[0].get('json', {}).get('output', {}).get('parameters', {}).get('extract', [])\n\n# Prepare variables\norder_items = []\ntable_number = None\n\n# Separate entries by type\nitems_list = []\nquantities = []\n\n# Parse all entries\nfor entry in extract_data:\n    if entry['name'] == 'table number':\n        table_number = entry['pattern']\n    elif entry['name'] == 'item':\n        items_list.append(entry['pattern'])\n    elif entry['name'] == 'quantity':\n        quantities.append(int(entry['pattern']))\n\n# Pair items and quantities\nfor i in range(len(items_list)):\n    item_data = {\n        'item': items_list[i],\n        'quantity': quantities[i] if i < len(quantities) else None,\n        'table': table_number\n    }\n    order_items.append(item_data)\n\n# Set final output\noutput = [{'json': item} for item in order_items]\n\nreturn output"
      },
      "typeVersion": 2
    },
    {
      "id": "a92d2745-148b-4e2a-b8f7-82d3993ff34f",
      "name": "項目ループ処理",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        620,
        500
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "aea89e6c-37a9-4859-adc8-b7e449701503",
      "name": "置換対象",
      "type": "n8n-nodes-base.noOp",
      "position": [
        800,
        660
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b31dba52-b27e-4267-be32-a7730b4d08a8",
      "name": "何も行わない",
      "type": "n8n-nodes-base.noOp",
      "position": [
        440,
        400
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d7f9a381-6bc2-44d0-81ac-6e0fbe77d70a",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -260,
        220
      ],
      "parameters": {
        "color": 3,
        "width": 340,
        "height": 680,
        "content": "## JSON PARSER\n\n1.converts the textual data final order like\nitem name \nquantity \nand table name in a json.\n\n2.if the data doesn't include the above it returns null."
      },
      "typeVersion": 1
    },
    {
      "id": "acc7a528-f767-4576-b08d-6fc386f57648",
      "name": "付箋1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        220
      ],
      "parameters": {
        "color": 2,
        "width": 460,
        "height": 680,
        "content": "## Refine/Split the jsons into multiple items\n\nIf the data from previous item is not null the custom code block splits the data into multiple json items in a list."
      },
      "typeVersion": 1
    },
    {
      "id": "857a3102-f5e1-4db5-afb4-154544414701",
      "name": "付箋2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        580,
        220
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 680,
        "content": "## Send each item as a record in Google sheet\n\n\n**Each item is looped over and produce a batch of 1 item and appended as row in sheet with timestamp.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a1ff2b0f-0b48-4ea2-8121-4e2d72197ef7",
      "name": "レストランチャットワークフローでトリガー",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -440,
        500
      ],
      "parameters": {
        "inputSource": "passthrough"
      },
      "typeVersion": 1.1
    },
    {
      "id": "8689b773-a1c4-4de4-a66e-fab8c9eb6244",
      "name": "チャットメッセージ受信時",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -140,
        -280
      ],
      "webhookId": "d931c4a7-02f5-4359-918f-7ad3fae7b144",
      "parameters": {
        "public": true,
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "de310ce2-3868-4a0f-aa9b-38253e75dbda",
      "name": "AIエージェント",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        100,
        -260
      ],
      "parameters": {
        "options": {
          "systemMessage": "\n\nYou are a polite and efficient restaurant assistant.\n\nYour job is to take customer orders, verify the order details, correct any mistakes, and confirm the order.\n\nFollow these steps:\n\nGreeting and Asking for the Order\n\nIf the customer greets you (e.g., \"Hello\", \"Hi\", \"Good evening\"), respond with:\n\n\"Hello! How can I assist you today? What would you like to order?\"\n\nOrder Parsing and Understanding\n\nAccept orders in flexible formats, such as:\n\n\"1 latte, 2 coffee, table number 5\"\n\n\"latte 2, pepsi 1, table 3\"\n\n\"1 cappucino\"\n\n\"1 tea table no 4\"\n\nYour goal is to extract the following:\n\nItem names (e.g., latte, coffee, chocolate, tea, pepsi)\n\nQuantities (must be numeric)\n\nTable number (must be numeric)\n\nVerify and Handle Missing or Incorrect Information\n\nFor each item in the order:\n\nIf the item name is missing, respond:\n\"Sorry, the item name is missing. What would you like to order?\"\n\nIf the quantity is missing, respond:\n\"How many [item] would you like?\"\n\nIf the table number is missing, respond:\n\"Could you please provide a table number?\"\n\nIf there are spelling mistakes in the item name, suggest corrections. Example:\n\"Did you mean chocolate instead of chocolat? Please confirm.\"\n\nUse fuzzy matching to detect common variations and typos.\n\nFinal Confirmation\n\nOnce all necessary details are collected, present an order summary like this:\n\nHere’s your order summary:\n\n1 latte\n\n2 coffee\n\nTable number: 5\nShall I confirm this order?\n\nOn Confirmation: Use the Tool\n\nWhen the user confirms, use the tool ConfirmOrder to send the final confirmation message as plain text in this format:\n\nThank you for confirming! Your order will be prepared shortly. Enjoy your time with us!\n\nOrder details are following:\nitem quantity\nlatte 1\ncoffee 2\n\nAdded to table number 5\n\nEnsure numeric values (quantities and table numbers) are correctly extracted, even if they appear at the start or end. Always confirm with the user if there is any uncertainty.\n\n\n\n\n\n\n\n\n"
        }
      },
      "typeVersion": 1.9
    },
    {
      "id": "9dda45ee-0a92-448c-8a7e-8daa99282cda",
      "name": "OpenAI チャットモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -20,
        20
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {
          "responseFormat": "text"
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "OizdHUANhz9NIHyd",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0c0189d5-8fb4-4679-b2e2-221a3e2a4c88",
      "name": "n8n ワークフローツールを呼び出し",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        360,
        20
      ],
      "parameters": {
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "wgaJ0eJQtYA8oKSC",
          "cachedResultName": "Restaurant POS workflow"
        },
        "description": "This tool sends the text output generated by the AI Agent node to another n8n workflow for additional handling or automation.",
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "notesInFlow": false,
      "typeVersion": 2.2
    },
    {
      "id": "9292db7f-6ffc-486e-b31a-bcbd6ef7ab98",
      "name": "直近5会話メモリ",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        140,
        40
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "2782d5b6-d33b-4c89-ac79-90bf380f0828",
      "name": "付箋3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        60,
        -380
      ],
      "parameters": {
        "width": 340,
        "height": 300,
        "content": "## Restaurant Order Chat bot\n** It chats with the user and refines the order for the pos system in another workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "7c298718-e9e3-40d3-a612-94c578bd3100",
      "name": "付箋4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        -20
      ],
      "parameters": {
        "color": 5,
        "content": "## Call the subworkflow\nit passes the data to the subworkflow for further process\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "aeefdd4b-bf7d-4824-97d8-0afc356fb7d6": {
      "main": [
        [
          {
            "node": "b31dba52-b27e-4267-be32-a7730b4d08a8",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "4cc1818f-1585-42e1-a111-7b55557aebcb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4cc1818f-1585-42e1-a111-7b55557aebcb": {
      "main": [
        [
          {
            "node": "a92d2745-148b-4e2a-b8f7-82d3993ff34f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "de310ce2-3868-4a0f-aa9b-38253e75dbda": {
      "main": [
        []
      ]
    },
    "aea89e6c-37a9-4859-adc8-b7e449701503": {
      "main": [
        [
          {
            "node": "a92d2745-148b-4e2a-b8f7-82d3993ff34f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a92d2745-148b-4e2a-b8f7-82d3993ff34f": {
      "main": [
        [
          {
            "node": "9e3f8a1b-ccd8-4f4d-91cb-b99cc46f412f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "aea89e6c-37a9-4859-adc8-b7e449701503",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9dda45ee-0a92-448c-8a7e-8daa99282cda": {
      "ai_languageModel": [
        [
          {
            "node": "de310ce2-3868-4a0f-aa9b-38253e75dbda",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "75883f27-af58-4791-9e1a-a70b83e1cead": {
      "ai_languageModel": [
        [
          {
            "node": "62b3c7cb-1993-44f1-8b86-38a34ca1d029",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "62b3c7cb-1993-44f1-8b86-38a34ca1d029": {
      "main": [
        [
          {
            "node": "aeefdd4b-bf7d-4824-97d8-0afc356fb7d6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0c0189d5-8fb4-4679-b2e2-221a3e2a4c88": {
      "ai_tool": [
        [
          {
            "node": "de310ce2-3868-4a0f-aa9b-38253e75dbda",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "8689b773-a1c4-4de4-a66e-fab8c9eb6244": {
      "main": [
        [
          {
            "node": "de310ce2-3868-4a0f-aa9b-38253e75dbda",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9292db7f-6ffc-486e-b31a-bcbd6ef7ab98": {
      "ai_memory": [
        [
          {
            "node": "de310ce2-3868-4a0f-aa9b-38253e75dbda",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "a1ff2b0f-0b48-4ea2-8121-4e2d72197ef7": {
      "main": [
        [
          {
            "node": "62b3c7cb-1993-44f1-8b86-38a34ca1d029",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

上級 - 営業, サポート, 人工知能

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
上級
ノード数19
カテゴリー3
ノードタイプ13
難易度説明

上級者向け、16ノード以上の複雑なワークフロー

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34