{
  "name": "SLACK BOT Demo for Pizza Shop",
  "nodes": [
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -240,
        240
      ],
      "id": "6405ffff-a970-4103-8439-f2648d554ec7",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "MzIepidaRw9ZqcPB",
          "name": "OpenAi account Credentials"
        }
      }
    },
    {
      "parameters": {
        "trigger": [
          "app_mention"
        ],
        "channelId": {
          "__rl": true,
          "value": "C09L60TJMS7",
          "mode": "list",
          "cachedResultName": "orders"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.slackTrigger",
      "typeVersion": 1,
      "position": [
        -176,
        -16
      ],
      "id": "8409086b-5358-46a5-bfc7-ef81b59bbda8",
      "name": "Slack Trigger",
      "webhookId": "5cce3d01-b540-4db4-bfca-8e8eb3b9ef61",
      "credentials": {
        "slackApi": {
          "id": "BjT4isxbN4tHqbOM",
          "name": "Slack account"
        }
      }
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "C09L60TJMS7",
          "mode": "list",
          "cachedResultName": "orders"
        },
        "text": "={{ $json.output }}",
        "otherOptions": {
          "includeLinkToWorkflow": false,
          "thread_ts": {
            "replyValues": {
              "thread_ts": "={{ $('Slack Trigger').item.json.ts }}"
            }
          }
        }
      },
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        448,
        -16
      ],
      "id": "0bc5ee64-3666-4abe-8f6c-22f993d57700",
      "name": "Send a message",
      "webhookId": "8cad2ad2-c609-4d11-b53d-9e02919b9009",
      "credentials": {
        "slackApi": {
          "id": "KMkFQmc4r1CU08xl",
          "name": "Slack account 2"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{$json[\"team\"]}}:{{$json[\"channel\"]}}:thread_{{ $json[\"thread_ts\"] || $json[\"ts\"] }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -96,
        240
      ],
      "id": "fec27209-8452-4e0b-ac33-36d74823d988",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "operation": "update",
        "dataTableId": {
          "__rl": true,
          "value": "vMVfpMac0076uNe0",
          "mode": "list",
          "cachedResultName": "Pizza Orders",
          "cachedResultUrl": "/projects/VXTtZRW7FLbtceR1/datatables/vMVfpMac0076uNe0"
        },
        "filters": {
          "conditions": [
            {
              "keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions0_Value', ``, 'string') }}"
            }
          ]
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Status": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Status', ``, 'string') }}"
          },
          "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.dataTableTool",
      "typeVersion": 1,
      "position": [
        80,
        240
      ],
      "id": "9ead9f38-2453-431c-bb23-f89d100c738b",
      "name": "Update row(s) in Data table"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "You are a helpful internal ai assistant on slack who updates the status of an order in the Order data table when a slack message has been recieved.\n\nYou must interpret the message and then come up with the correct status and update the data table order.\n\nNext you must use Get row(s) in Data table tool to get the details of the Customer's order such as their name, email, item, quantity etc.\n\nFinally you must use that information to send a personalised email regarding their order."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        48,
        -16
      ],
      "id": "32a8b1ee-a4b9-4fca-bebf-d21ca0ff90d7",
      "name": "Pizza Order AI Agent"
    },
    {
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
        "emailType": "text",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmailTool",
      "typeVersion": 2.1,
      "position": [
        416,
        240
      ],
      "id": "cab9ffe6-96a3-4d0e-b9b1-616d364a9bf9",
      "name": "Send a message in Gmail",
      "webhookId": "7c2c0c2a-34b7-4e0c-8ae0-dc4672bd2333",
      "credentials": {
        "gmailOAuth2": {
          "id": "xmp6P6qtAw4JgOCe",
          "name": "Gmail account"
        }
      }
    },
    {
      "parameters": {
        "operation": "get",
        "dataTableId": {
          "__rl": true,
          "value": "vMVfpMac0076uNe0",
          "mode": "list",
          "cachedResultName": "Pizza Orders",
          "cachedResultUrl": "/projects/VXTtZRW7FLbtceR1/datatables/vMVfpMac0076uNe0"
        },
        "filters": {
          "conditions": [
            {
              "keyValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('conditions0_Value', ``, 'string') }}"
            }
          ]
        },
        "returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}"
      },
      "type": "n8n-nodes-base.dataTableTool",
      "typeVersion": 1,
      "position": [
        272,
        240
      ],
      "id": "80cdc3fe-fd2a-49ad-8de4-f5f0d6ac3641",
      "name": "Get row(s) in Data table"
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Pizza Order AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Slack Trigger": {
      "main": [
        [
          {
            "node": "Pizza Order AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Pizza Order AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Update row(s) in Data table": {
      "ai_tool": [
        [
          {
            "node": "Pizza Order AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Pizza Order AI Agent": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "Pizza Order AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in Data table": {
      "ai_tool": [
        [
          {
            "node": "Pizza Order AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0c1ecc98-e54e-425a-92b3-a4090d266eff",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "4aabc0aa2e160dafa4f9d9bcedde563b5af29598cd16960f637ae2fb99aea720"
  },
  "id": "9CtBoeuo1CBFH6A6",
  "tags": []
}