{
  "name": "TwitterShots Telegram Bot",
  "nodes": [
    {
      "parameters": {
        "statusId": "={{ $json.message.text }}",
        "format": "png",
        "additionalFields": {}
      },
      "type": "n8n-nodes-twittershots.twitterShots",
      "typeVersion": 1,
      "position": [
        624,
        0
      ],
      "id": "7d591c9e-1b3e-46dd-b631-e295b82ab708",
      "name": "Get a tweet screenshot",
      "credentials": {
        "twitterShotsApi": {
          "id": "9BgD7QHDNAb7geSV",
          "name": "TwitterShots account"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "81e0e5f0-c82f-451c-8972-7a397b26b53f",
              "name": "message.text",
              "value": "={{\n  (() => {\n    const text = $(\"Telegram Message Trigger\").item.json.message.text;\n    // Check if it's a numeric tweet ID\n    if (/^\\d+$/.test(text)) {\n      return text;\n    }\n    // Check if it's a tweet URL and extract the ID\n    const match = text.match(/status\\/(\\d+)/);\n    if (match) {\n      return match[1];\n    }\n    // Otherwise, return the original text\n    return text;\n  })()\n}}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        208,
        0
      ],
      "id": "a5413a38-b080-4d47-b02e-34d2822ddae8",
      "name": "Get Tweet Id"
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "id": "52fa185f-5d29-4ad5-b257-9702d7cd435c",
      "name": "Telegram Message Trigger",
      "webhookId": "261d5391-e778-440f-aa98-c3887ddca60e",
      "credentials": {
        "telegramApi": {
          "id": "rQBAHMX4YyzdlBgh",
          "name": "Telegram account"
        }
      }
    },
    {
      "parameters": {
        "operation": "sendPhoto",
        "chatId": "={{ $('Telegram Message Trigger').item.json.message.chat.id }}",
        "binaryData": true,
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        832,
        0
      ],
      "id": "5c868626-f8a0-4d17-981b-b3925ce01ae3",
      "name": "Send Screenshot message",
      "webhookId": "9528807e-85d7-4317-a412-4b7230315348",
      "credentials": {
        "telegramApi": {
          "id": "rQBAHMX4YyzdlBgh",
          "name": "Telegram account"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "3d714f71-429f-4267-9df9-b134e2a3aace",
              "leftValue": "={{ $json.message.text }}",
              "rightValue": "^\\d{10,20}$",
              "operator": {
                "type": "string",
                "operation": "regex"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        400,
        0
      ],
      "id": "f936d22c-0269-4a7a-b577-caf68e7542b9",
      "name": "If"
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Message Trigger').item.json.message.chat.id }}",
        "text": "Enter a tweet URL or ID.",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        624,
        160
      ],
      "id": "cbd751cf-add7-45a5-9d31-c24519c0fac9",
      "name": "Send a text message",
      "webhookId": "24944a22-cd4b-4540-a97e-409c271c2da9",
      "credentials": {
        "telegramApi": {
          "id": "rQBAHMX4YyzdlBgh",
          "name": "Telegram account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Get a tweet screenshot": {
      "main": [
        [
          {
            "node": "Send Screenshot message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Tweet Id": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Message Trigger": {
      "main": [
        [
          {
            "node": "Get Tweet Id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Get a tweet screenshot",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "versionId": "d6c683c0-aa9c-45c0-9f53-0b3717d8d63b",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "e39499fdd8705cc482b3da5e37cd2f2b428d03c8da883d31d22d7e1f54b0eb9a"
  },
  "id": "T3eCzI0KjYSAVD5O",
  "tags": []
}