{
  "name": "Create social media content from Telegram with AI",
  "nodes": [
    {
      "id": "070fd7b4-58ca-4372-a347-6f60f590e20b",
      "name": "Receive Telegram Messages",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        40,
        140
      ]
    },
    {
      "id": "0e0f3a32-fbde-42a9-aa7f-70fda7b05357",
      "name": "Voice or Text?",
      "type": "n8n-nodes-base.switch",
      "position": [
        400,
        220
      ]
    },
    {
      "id": "b01dde88-bede-4500-974f-b2dc203ff841",
      "name": "Fetch Voice Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        760,
        120
      ]
    },
    {
      "id": "fe91414e-3b10-482e-b8dd-d55266828dd7",
      "name": "Transcribe Voice to Text",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        980,
        120
      ]
    },
    {
      "id": "74549458-fd4d-4824-a561-944f2f536b9b",
      "name": "Prepare for LLM",
      "type": "n8n-nodes-base.set",
      "position": [
        880,
        340
      ]
    },
    {
      "id": "886246ad-7127-462a-a2b2-b4281f369d8b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        0
      ],
      "parameters": {
        "width": 260,
        "height": 320,
        "content": " \n**This workflow listens for incoming voice or text messages from Telegram users.** "
      }
    },
    {
      "id": "d052bd49-dc23-4ec5-b153-a9eb305f0641",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        20
      ],
      "parameters": {
        "width": 460,
        "height": 260,
        "content": " **Voice messages are fetched from Telegram and transcribed into text using OpenAI's Whisper API.**  "
      }
    },
    {
      "id": "156580f1-adf5-43ba-b54d-89b84ca87818",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1460,
        320
      ]
    },
    {
      "id": "74f99543-d7e6-4d9b-8af1-9d86e0566ddc",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1460,
        560
      ]
    },
    {
      "id": "62b9bb5f-0c87-4df4-ac1c-70b96a0a5cc4",
      "name": "SerpAPI",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "position": [
        1580,
        560
      ]
    },
    {
      "id": "3782a100-3210-4c87-9e6a-5808cd488601",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1700,
        560
      ]
    },
    {
      "id": "87bf4b00-4f75-4098-993b-b4bd168339c2",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        2380,
        320
      ]
    },
    {
      "id": "9a273f0b-bcb0-4ed8-93f5-6161d192e3ef",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1460,
        160
      ],
      "parameters": {
        "width": 280,
        "height": 140,
        "content": " **The AI agent uses the OpenAI Chat Model and SerpAPI tool to conduct research and generate social media content and an image prompt based on the user request.**"
      }
    },
    {
      "id": "c907aa15-1ccf-475e-94da-3a81e54b3746",
      "name": "Prepare Final Output",
      "type": "n8n-nodes-base.set",
      "position": [
        2740,
        320
      ]
    },
    {
      "id": "0893eac1-e72b-4a95-8c3c-4803aaaed9b9",
      "name": "Generate Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2020,
        320
      ]
    },
    {
      "id": "b99a090f-73de-4703-b569-8992df36132f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1960,
        240
      ],
      "parameters": {
        "width": 220,
        "height": 240,
        "content": " **An image is generated using the image prompt**  "
      }
    }
  ],
  "connections": {
    "SerpAPI": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Generate Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Voice or Text?": {
      "main": [
        [
          {
            "node": "Fetch Voice Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare for LLM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare for LLM": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Prepare Final Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Voice Message": {
      "main": [
        [
          {
            "node": "Transcribe Voice to Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Final Output": {
      "main": [
        []
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe Voice to Text": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Telegram Messages": {
      "main": [
        [
          {
            "node": "Voice or Text?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}