{
  "name": "Project: WordPress Blog Post",
  "nodes": [
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "id": "daa984fe-5380-41ee-8e61-0d11aa312ccc",
      "name": "Telegram Trigger",
      "webhookId": "ddbd0aed-0c54-4e98-87d4-b9f4b0133c63",
      "credentials": {
        "telegramApi": {
          "id": "DA4UGj08LgRnRgDf",
          "name": "Catalin Telegram Bot"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.message.text }}",
        "options": {
          "systemMessage": "=Take the user's message and distill it into 1-5 words. Output the words separated by + signs, and nothing else.\nThe output will be used in a web query so be very precise with formatting. Only words separated by + signs, nothing else"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        208,
        0
      ],
      "id": "46234a26-7b1f-4a72-bac7-cbad919163e9",
      "name": "Search query agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        368,
        384
      ],
      "id": "6fcd0be3-3d5b-4b4d-83d9-2a1a2e873c95",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "xHWDVrLvQFklSodD",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "url": "https://www.googleapis.com/customsearch/v1",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "AIzaSyBGoRW7PKeTgouh93rnuuRpuRyN20wFdkE"
            },
            {
              "name": "cx",
              "value": "55b8201464ff24ae8"
            },
            {
              "name": "q",
              "value": "={{ $json.output }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        560,
        0
      ],
      "id": "aee09a56-6936-4327-a85c-93e9ffe59e47",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.items }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "=You are a master blog writer. \nThe user input is a web search of news articles related to the user's query.\n\nTake an article and write a blog post about it. Make it interesting and engaging.\nCreate an interesting and engaging title.\n\nOutput the title and content according to the output JSON, don't output anything extra."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        768,
        0
      ],
      "id": "29c87655-0fe0-493f-8866-c465fade98a1",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n\t\"title\": \"Blog title\",\n\t\"content\": \"Blog content\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        912,
        256
      ],
      "id": "a655463b-9dd6-493d-9227-42ce0c2ca733",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "title": "={{ $json.output.title }}",
        "additionalFields": {
          "content": "={{ $json.output.content }}",
          "status": "publish"
        }
      },
      "type": "n8n-nodes-base.wordpress",
      "typeVersion": 1,
      "position": [
        1120,
        0
      ],
      "id": "09b18fa2-af4a-4555-8f40-bf91a5837354",
      "name": "Create a post",
      "credentials": {
        "wordpressApi": {
          "id": "B4GBAfCfdxoP9VLX",
          "name": "Wordpress account 2"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "text": "=Article Generated\n\n{{ $json.title.raw }}\n\n{{ $json.guid.rendered }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        1328,
        0
      ],
      "id": "c2dd0589-20d8-4de0-95a3-79928ece66cd",
      "name": "Send a text message",
      "webhookId": "a66855ce-35d3-48b0-b67b-769615974353",
      "credentials": {
        "telegramApi": {
          "id": "DA4UGj08LgRnRgDf",
          "name": "Catalin Telegram Bot"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Search query agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Search query agent",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Search query agent": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Create a post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a post": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "11ad1be8-05b5-4928-8291-159ec7789d6d",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "281c34c03b9c41f054c536eeb966e9e503918cf7f00e3bc32a5ff9cca85ca255"
  },
  "id": "5ei5gxHgiCw7RZ7Z",
  "tags": []
}