AutomationFlowsAI & RAG › Bebo Chat

Bebo Chat

bebo-chat. Uses agent, lmChatOpenAi, memoryBufferWindow, outputParserStructured. Webhook trigger; 13 nodes.

Webhook trigger★★★★☆ complexityAI-powered13 nodesAgentOpenAI ChatMemory Buffer WindowOutput Parser StructuredData TableHTTP Request
AI & RAG Trigger: Webhook Nodes: 13 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Datatable recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "active": true,
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Start Image Generation": {
      "main": [
        []
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Insert generation request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert generation request": {
      "main": [
        [
          {
            "node": "Respond to Webhook1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond to Webhook1": {
      "main": [
        [
          {
            "node": "Start Image Generation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "createdAt": "2025-10-23T14:58:27.131Z",
  "id": "xmTVQ50hxXcbVqVS",
  "isArchived": false,
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "bebo-chat",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "chat",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -80,
        32
      ],
      "id": "3ca3b52f-6b88-4600-984c-72a2d005b116",
      "name": "Webhook"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "0ff87862-a531-4c00-8f18-78b29c16fdbe",
              "name": "body",
              "value": "={{ $json.body }}",
              "type": "object"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        144,
        32
      ],
      "id": "9e00a8db-3f6b-49a8-8181-02fb7ff56f6d",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=User Prompt: {{ $json.body['text-prompt'] }}\nUser uploaded this image: {{ $json.body['image-prompt-url'] }}\nUser image generation intent: {{ $json.body['is-generate-mode'] }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "You are the AI visual design assistant of birebiro.com.\n\nYour personality:\nYou speak like a friendly and expert interior designer & art consultant.\nYou talk only about art, interior design, decoration, colors, styles, compositions, creativity, and visual storytelling.\nYou NEVER talk about unrelated topics.\n\nDefault conversation language is Turkish, unless the user writes in another language.\n\nYou are given the following runtime values from n8n:\n\n- User Prompt: {{ $json.body['text-prompt'] }}\n- User uploaded this image: {{ $json.body['image-prompt-url'] }}\n- User image generation intent: {{ $json.body['is-generate-mode'] }}  (true / false)\n\n\"User image generation intent\" indicates whether the user clicked the image generation button on the interface.\n\nYour ONLY job is to return ONE JSON object in the following exact format, with no extra text:\n\n{\n  \"reply_to_user\": \"\",\n  \"user_generation_intent\": true,\n  \"improved_generation_prompt\": \"\"\n}\n\nRules for fields:\n\n1) reply_to_user\n- Always talk like an interior designer / art consultant.\n- Always in Turkish, unless the user clearly uses another language.\n- When image generation intent is true, reply with an enthusiastic confirmation such as:\n  - \"Harika! Bu fikir harika g\u00f6r\u00fcn\u00fcyor, hemen g\u00f6rselinizi olu\u015fturmaya ba\u015fl\u0131yorum \ud83c\udfa8\u2728\"\n  - \"Tamamd\u0131r! \u015eimdi bu tasar\u0131m\u0131n\u0131z\u0131 hayata ge\u00e7iriyorum \ud83d\uddbc\ufe0f\"\n- When image generation intent is false, stay in inspiration mode: give decoration, color, tarz, kompozisyon \u00f6nerileri.\n\n2) user_generation_intent\n- This field in your JSON reflects whether YOU think an image should be generated for this turn.\n- HOWEVER, if the incoming \"User image generation intent\" ({{ $json.body['is-generate-mode'] }}) is true, you MUST set \"user_generation_intent\" to true in your JSON.\n- If {{ $json.body['is-generate-mode'] }} is false, then:\n  - You are in inspiration/chat mode.\n  - Normally set \"user_generation_intent\" to false.\n  - Even if the user asks for an image, tell them they must activate the image generation button.\n\n3) improved_generation_prompt\n- This is a polished, detailed ENGLISH image prompt.\n- It is used by the image generation model.\n- If \"user_generation_intent\" is true, you MUST ALWAYS fill this field with a NON-EMPTY prompt.\n- NEVER leave \"improved_generation_prompt\" empty when \"user_generation_intent\" is true.\n- Use the User Prompt ({{ $json.body['text-prompt'] }}) as the base.\n- If the user uploaded an image ({{ $json.body['image-prompt-url'] }} is not empty), incorporate it logically into the prompt (e.g., \"Use the uploaded image as a base/reference...\").\n- If the user prompt is very short or vague, you must still create a meaningful, creative prompt based on typical interior decoration / art / wall art / pillow cover / canvas ideas.\n\nBehavior depending on \"User image generation intent\":\n\nA) When {{ $json.body['is-generate-mode'] }} is true:\n- You are in GENERATION MODE.\n- In the JSON:\n  - \"user_generation_intent\": true\n  - \"improved_generation_prompt\": MUST be a detailed English image prompt (never empty).\n  - \"reply_to_user\": short, warm Turkish confirmation that you are starting to generate the image.\n- You must NOT ask for more details even if the prompt is weak; instead, you creatively complete the idea yourself.\n\nB) When {{ $json.body['is-generate-mode'] }} is false:\n- You are in INSPIRATION MODE (no image will be generated this turn).\n- In the JSON:\n  - \"user_generation_intent\": false\n  - \"improved_generation_prompt\": \"\" (must be empty).\n- Your \"reply_to_user\" should:\n  - Give artistic, decorative, or interior design guidance, inspirations, color palette suggestions, composition ideas, etc.\n- If the user insists on generating an image while you are in this mode, say in Turkish:\n  - \"G\u00f6rsel olu\u015fturma modunda de\u011filsiniz. Sa\u011f \u00fcstteki \u2018G\u00f6rsel Olu\u015ftur\u2019 butonuna t\u0131klamal\u0131s\u0131n\u0131z. \u015eu anda ilham modunday\u0131m.\"\n  and keep \"user_generation_intent\": false and \"improved_generation_prompt\": \"\".\n\nAdditional strict rules:\n- You must ALWAYS return ONLY the JSON object with the three fields:\n  - reply_to_user\n  - user_generation_intent\n  - improved_generation_prompt\n- NEVER add or remove fields.\n- NEVER output anything outside the JSON (no explanations, no Markdown, no backticks).\n- NEVER talk about non-art, non-design, non-decoration topics.\n- NEVER say that you cannot process images; always assume the system handles them.\n- DO NOT answer in multiple lines. Only answer max 2 lines of answer not more! "
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        432,
        32
      ],
      "id": "42b51885-a4dc-446b-bed4-2a4a59b769b8",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o",
          "mode": "list",
          "cachedResultName": "gpt-4o"
        },
        "options": {
          "responseFormat": "text"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        336,
        256
      ],
      "id": "3834f476-2046-42d7-8001-564a8ff6c83c",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.body['chat-session-id'] }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        512,
        368
      ],
      "id": "41d84c58-0618-4667-bcd7-d0141048a4cc",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "a578a99a-3192-4ee8-be0e-06e34c507447",
              "leftValue": "={{ $json.output.user_generation_intent }}",
              "rightValue": "true",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        912,
        32
      ],
      "id": "6fc5ef1b-bef9-4172-be32-edb225fe3777",
      "name": "If"
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"reply_to_user\": \"\",\n  \"user_generation_intent\": false,\n  \"improved_generation_prompt\": \"\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        688,
        256
      ],
      "id": "35a4cb1e-8e33-4a55-9854-3306f40be2e8",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://n8n-production-14b9.up.railway.app/webhook/start-image-generation",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "=user_id",
              "value": "={{ $('Webhook').item.json.body['user-id'] }}"
            },
            {
              "name": "improved_user_prompt",
              "value": "={{ $('AI Agent').item.json.output.improved_generation_prompt }}"
            },
            {
              "name": "image_prompt_url",
              "value": "={{ $('Webhook').item.json.body['image-prompt-url'] }}"
            },
            {
              "name": "resolution",
              "value": "={{ $('Webhook').item.json.body.resolution }}"
            },
            {
              "name": "quality",
              "value": "={{ $('Webhook').item.json.body.quality }}"
            },
            {
              "name": "image_prompt",
              "value": "={{ $('Webhook').item.json.body['image-prompt'] }}"
            },
            {
              "name": "generation_id",
              "value": "={{ $json.id }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        2288,
        -368
      ],
      "id": "6df8fe1c-82a7-43d4-8ad9-48ce4324e247",
      "name": "Start Image Generation"
    },
    {
      "parameters": {
        "jsCode": "// Giri\u015ften userID al\nconst userID = $('Webhook').first().json.body['user-id'] || 0;\n\n// 10.000\u201320.000 aras\u0131nda rastgele say\u0131 \u00fcret\nconst randomNumber = Math.floor(Math.random() * (20000 - 10000 + 1)) + 10000;\n\n// userID ile birle\u015ftir (\u00f6rnek: 123 + 15732 \u2192 12315732)\nconst combinedID = `${userID}-${randomNumber}`;\n\nreturn [\n  {\n    json: {\n      userID,\n      randomNumber,\n      combinedID\n    }\n  }\n];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1488,
        -128
      ],
      "id": "11222ede-baa6-4955-b744-760d38edebd7",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"reply_to_user\": \"{{ $('AI Agent').item.json.output.reply_to_user }}\",\n  \"image_generation\": true,\n  \"generation_id\": \"{{ $json.id }}\"\n} ",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        2048,
        -128
      ],
      "id": "cb2d19a5-9295-459e-b2f8-c448d202168c",
      "name": "Respond to Webhook1"
    },
    {
      "parameters": {
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "generated_image",
          "mode": "list",
          "cachedResultName": "generated_image"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "is_generate_mode": "={{ $('Webhook').item.json.body['is-generate-mode'] }}",
            "is_selected": false,
            "credit_used": "={{ $('Webhook').item.json.body['credit-used'] }}",
            "chat_session_id": "={{ $('Webhook').item.json.body['chat-session-id'] }}",
            "text_prompt": "={{ $('Webhook').item.json.body['text-prompt'] }}",
            "improved_prompt": "={{ $('AI Agent').item.json.output.improved_generation_prompt }}",
            "user_generation_intent": "={{ $('Webhook').item.json.body['is-generate-mode'] }}",
            "uploaded_image_url": "={{ $('Webhook').item.json.body['image-prompt-url'] }}",
            "generation_id": "={{ $json.combinedID }}",
            "user_id": "={{ $('Webhook').item.json.body['user-id'] }}",
            "product_frame_id": "={{ $('Webhook').item.json.body['product-frame-id'] }}",
            "product_size_id": "={{ $('Webhook').item.json.body['product-size-id'] }}",
            "product_id": "={{ $('Webhook').item.json.body['product-id'] }}"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "user_id",
              "displayName": "user_id",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "chat_session_id",
              "displayName": "chat_session_id",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "generation_id",
              "displayName": "generation_id",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "product_id",
              "displayName": "product_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "product_size_id",
              "displayName": "product_size_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "product_frame_id",
              "displayName": "product_frame_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "text_prompt",
              "displayName": "text_prompt",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "improved_prompt",
              "displayName": "improved_prompt",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "image_url",
              "displayName": "image_url",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "uploaded_image_url",
              "displayName": "uploaded_image_url",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "user_generation_intent",
              "displayName": "user_generation_intent",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "is_generate_mode",
              "displayName": "is_generate_mode",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "boolean",
              "canBeUsedToMatch": true
            },
            {
              "id": "credit_used",
              "displayName": "credit_used",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "is_selected",
              "displayName": "is_selected",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "boolean",
              "canBeUsedToMatch": true
            },
            {
              "id": "updated_at",
              "displayName": "updated_at",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "canBeUsedToMatch": true
            },
            {
              "id": "created_at",
              "displayName": "created_at",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        1776,
        -128
      ],
      "id": "2868391f-1fb5-43d9-ba98-9528d83beb82",
      "name": "Insert generation request",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\n  \"reply_to_user\": \"{{ $('AI Agent').item.json.output.reply_to_user }}\",\n  \"image_generation\": false,\n  \"generation_id\": \"\"\n} ",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        1488,
        48
      ],
      "id": "4c1f0407-e671-4516-82d2-909003351a67",
      "name": "Respond to Webhook"
    }
  ],
  "origin": "n8n",
  "repo": {
    "owner": "octaworksofficial",
    "name": "n8n"
  },
  "settings": {
    "executionOrder": "v1"
  },
  "shared": [
    {
      "createdAt": "2025-10-23T14:58:27.136Z",
      "updatedAt": "2025-10-23T14:58:27.136Z",
      "role": "workflow:owner",
      "workflowId": "xmTVQ50hxXcbVqVS",
      "projectId": "1jTilK588wM2KuJy"
    }
  ],
  "staticData": null,
  "tags": [],
  "triggerCount": 1,
  "updatedAt": "2025-11-20T10:44:45.000Z",
  "versionId": "b0619243-9444-4d8b-878d-5e8322f06429"
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

bebo-chat. Uses agent, lmChatOpenAi, memoryBufferWindow, outputParserStructured. Webhook trigger; 13 nodes.

Source: https://github.com/octaworksofficial/n8n/blob/20a248338297da94c67a12b0db3035f88d91a82f/BEBO/bebo-chat.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

🧠 Gwen – The AI Voice Marketing Agent Gwen is your intelligent voice-powered marketing assistant built in n8n. She combines the power of OpenAI, ElevenLabs, and automation workflows to handle content

Tool Workflow, Memory Buffer Window, Agent +10
AI & RAG

Public-facing professionals (developer advocates, founders, marketers, content creators) who get bombarded with LinkedIn messages that aren't actually for them - support requests when you're in market

Slack, HTTP Request, Agent +4
AI & RAG

This workflow automates enterprise resource planning (ERP) operations across Engineering, Finance, HR, and Admin departments for operations managers, ERP administrators, and business process owners wh

Agent, Gmail, Slack +6
AI & RAG

1-[Agente-Abogado]-Asistente-Whatsapp. Uses lmChatOpenAi, toolWorkflow, toolCalculator, agent. Webhook trigger; 52 nodes.

OpenAI Chat, Tool Workflow, Tool Calculator +8
AI & RAG

Top Branch Workflow A The Market Intelligence: Patrols the Market: Runs hourly to scrape competitor rates for future days. Gathers Intel: If prices spike, it instantly checks event announcements to se

HTTP Request, Data Table, Output Parser Structured +6