{
  "name": "Project: Popular Meme Generator",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        0
      ],
      "id": "bb8ef4ef-9fcb-47e4-8251-ed09003c1d07",
      "name": "When chat message received",
      "webhookId": "08d2d529-557c-429c-a23c-3f4647c0992a"
    },
    {
      "parameters": {
        "url": "https://api.imgflip.com/get_memes",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        208,
        0
      ],
      "id": "588ab0e9-bbb5-4e67-91ed-52459d8db42f",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=User input:\n{{ $('When chat message received').item.json.chatInput }}\n\nAvailable meme templates:\n{{ $json.data.memes }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=You are a meme generator bot. You try to make memes that are insightful and funny. You will receive the user input and a list of the most popular current memes. \n\nTake the user input and create an idea for a meme.\n\nThen from the list of available memes, choose one. Each meme has 2 boxes and texts that you need to generate.\n\nFinally output the info based on the required output json\n\nget the exact template id from the meme you chose and copy it into the output\n\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        416,
        0
      ],
      "id": "02bbb295-3315-4b3d-862e-9b0cf6f273c1",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        368,
        208
      ],
      "id": "69dbf3ec-ef92-4e03-ba26-d665fedcdc5d",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "xHWDVrLvQFklSodD",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n\t\"template_id\": \"TemplateId\",\n\t\"text0\": \"First box text\",\n\t\"text1\": \"Second box text\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        592,
        208
      ],
      "id": "54bf2bfc-16cd-473a-b5b6-51bf35157dca",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "url": "https://api.imgflip.com/caption_image",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "template_id",
              "value": "={{ $('AI Agent').item.json.output.template_id }}"
            },
            {
              "name": "username",
              "value": "={{ $json.username }}"
            },
            {
              "name": "password",
              "value": "={{ $json.password }}"
            },
            {
              "name": "text0",
              "value": "={{ $('AI Agent').item.json.output.text0 }}"
            },
            {
              "name": "text1",
              "value": "={{ $('AI Agent').item.json.output.text1 }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        976,
        0
      ],
      "id": "ec86afe9-2c89-4efa-93f9-9c12ec496785",
      "name": "HTTP Request1"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "42c8b2b5-5248-4f3e-b81f-222f5bc76e71",
              "name": "username",
              "value": "CatalinStefan10",
              "type": "string"
            },
            {
              "id": "1f904e88-bdde-413f-990b-e34d2c9eaea2",
              "name": "password",
              "value": "abc123123!",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        768,
        0
      ],
      "id": "5b7d60f5-703d-46d8-915d-09ca8d2f64ed",
      "name": "Edit Fields"
    }
  ],
  "pinData": {},
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8c938a0f-63bb-4d09-b3f5-7f14686cc6be",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "281c34c03b9c41f054c536eeb966e9e503918cf7f00e3bc32a5ff9cca85ca255"
  },
  "id": "jr8p6TM12DfZy6Yi",
  "tags": []
}