AutomationFlowsAI & RAG › AI Image Generation Bot

AI Image Generation Bot

Original n8n title: N8n Image Bot

n8n image bot. Uses agent, lmChatOpenAi, httpRequest, memoryBufferWindow. Webhook trigger; 6 nodes.

Webhook trigger★★★★☆ complexityAI-powered6 nodesAgentOpenAI ChatHTTP RequestMemory Buffer Window
AI & RAG Trigger: Webhook Nodes: 6 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → HTTP Request 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
{
  "name": "n8n image bot",
  "nodes": [
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.body.last_user_message }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "You are an assistant for a fast food restaurant. Always say hello to the user, inform that he is talking with a Restaurant and offer a simple list for the menu. Provide a brief description and price for each of the following items and add the image link avoid using \\n in the text.\n\nPizza\nhttps://images.pexels.com/photos/842519/pexels-photo-842519.jpeg\nDescription: A delicious pizza with a variety of toppings including pepperoni, mushrooms, and extra cheese.\nPrice: $12.99\n\nHotdog\nhttps://images.pexels.com/photos/30635915/pexels-photo-30635915.jpeg\nDescription: A classic hotdog with a juicy sausage, topped with mustard, ketchup, onions, and relish.\nPrice: $4.99\n\nBurger\nhttps://images.pexels.com/photos/1251198/pexels-photo-1251198.jpeg\nDescription: A mouth-watering burger with a beef patty, lettuce, tomato, cheese, and special sauce.\nPrice: $7.99"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        140,
        0
      ],
      "id": "9f6c2ac2-194f-4dcd-9660-a14abc00f09f",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": "gpt-4o",
        "options": {
          "responseFormat": "text"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        80,
        240
      ],
      "id": "ea2e29e9-c938-4171-ada5-737069386865",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.p.2chat.io/open/whatsapp/send-message",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-User-API-Key",
              "value": "UAK85276705-e4c6-4a65-a8b3-01c69a406cdd"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"to_number\": \"{{ $('Webhook').item.json.body.to_number }}\",\n  \"from_number\": \"+573054684700\",\n  \"text\": \"{{ $json.output }}\",\n  \"url\": \"{{ $json.url }}\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        820,
        0
      ],
      "id": "3a0dc4bc-9e72-4392-a581-db767bf14393",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "2chat-food",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -140,
        0
      ],
      "id": "d0f538f2-b4d7-42d0-a787-2136ac6789de",
      "name": "Webhook"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Webhook').item.json.body.to_number }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        220,
        240
      ],
      "id": "a29b95a7-7f67-4583-9047-ed4c559b35ca",
      "name": "Window Buffer Memory"
    },
    {
      "parameters": {
        "language": "python",
        "pythonCode": "import re\n# Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor item in _input.all():\n  url =re.search('http.+\\/\\/.+[a-z]', item.json.output)\n  if url:\n    item.json.url = url[0]\n  else:\n    item.json.url = \"\"\n  item.json.output=item.json.output.replace(\"\\n\",\"\")\nreturn _input.all()"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        0
      ],
      "id": "466d4838-d638-42ce-9e20-f468dbb884e1",
      "name": "Code"
    }
  ],
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Window Buffer Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4d9457df-05a2-4599-bbdd-673d5324bc4a",
  "id": "oisSgR8UnZ7wLsoC",
  "tags": []
}

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

n8n image bot. Uses agent, lmChatOpenAi, httpRequest, memoryBufferWindow. Webhook trigger; 6 nodes.

Source: https://github.com/2ChatCo/Tutorials/blob/903ea0c69c017f976963d051c2acd5baef3578b6/n8n/n8n_image_bot.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

L&D_AgentsAI_ATIVO. Uses httpRequest, agent, googleCalendarTool, toolSerpApi. Webhook trigger; 93 nodes.

HTTP Request, Agent, Google Calendar Tool +9
AI & RAG

My workflow 15. Uses httpRequest, memoryBufferWindow, agent, lmChatOpenAi. Webhook trigger; 74 nodes.

HTTP Request, Memory Buffer Window, Agent +5
AI & RAG

Flux. Uses lmChatOpenAi, agent, googleGemini, httpRequest. Webhook trigger; 67 nodes.

OpenAI Chat, Agent, Google Gemini +8
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