{
  "id": "SGqUVskzXEBI5EHa",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Telegram AI Image Generator + Google Sheets Logger",
  "tags": [],
  "nodes": [
    {
      "id": "09061203-acb3-45f3-a2e9-a6899fab1260",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -100,
        -40
      ],
      "parameters": {
        "prompt": "={{ $json.message.text }}",
        "options": {
          "size": "1024x1024",
          "dalleQuality": "standard",
          "returnImageUrls": true
        },
        "resource": "image"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "a571ef80-e5ab-457f-8bf0-ab4372420819",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -320,
        -40
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "90001184-fca0-44a2-892b-72c772bfd6da",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        380,
        -40
      ],
      "parameters": {
        "file": "={{ $json['Image title'] }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "operation": "sendPhoto",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "924d8b95-8687-4419-b994-93e32a23ea24",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        -360
      ],
      "parameters": {
        "width": 920,
        "height": 480,
        "content": "## Telegram AI Image Generator + Google Sheets Logger\n1. Telegram Trigger\nReceives image generation requests from users directly via Telegram.\n\n2. OpenAI Node\nProcesses the request by generating the required image based on the user\u2019s prompt.\n\n3. Saves the prompt and generated image link to Google Sheets.\n\n4. Telegram Send Message\nSends the generated image back to the user in Telegram as a seamless automated response.\n\nLoom Demo : [Link](https://www.loom.com/share/1c5e645442f6441baf9efd12a334eef0)"
      },
      "typeVersion": 1
    },
    {
      "id": "aed2c34b-ef3f-465d-a5bd-9d3fda8f9a9a",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        160,
        -40
      ],
      "parameters": {
        "columns": {
          "value": {
            "Image title": "={{ $json.url }}",
            "Image description": "={{ $json.revised_prompt }}"
          },
          "schema": [
            {
              "id": "Image description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Image description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Image title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iABxBKBY9ERctigW1bYvvRTIAf-m-InTSvSKnqANUhg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1iABxBKBY9ERctigW1bYvvRTIAf-m-InTSvSKnqANUhg",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1iABxBKBY9ERctigW1bYvvRTIAf-m-InTSvSKnqANUhg/edit?usp=drivesdk",
          "cachedResultName": "image database"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2e4735b4-9872-45d0-af17-2af4314ad196",
  "connections": {
    "OpenAI": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram": {
      "main": [
        []
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}