AutomationFlowsSlack & Telegram › Telegram Media Handler with Supabase

Telegram Media Handler with Supabase

Original n8n title: [hub] Жора Media

[HUB] Жора Media. Uses executeWorkflowTrigger, supabase, telegram. Event-driven trigger; 9 nodes.

Event trigger★★★★☆ complexity9 nodesExecute Workflow TriggerSupabaseTelegram
Slack & Telegram Trigger: Event Nodes: 9 Complexity: ★★★★☆ Added:

This workflow follows the Execute Workflow Trigger → Telegram recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "[HUB] \u0416\u043e\u0440\u0430 Media",
  "description": null,
  "nodes": [
    {
      "id": "media-trigger",
      "name": "When Called by \u0416\u043e\u0440\u0430",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        -200,
        0
      ],
      "parameters": {
        "inputSource": "passthrough"
      }
    },
    {
      "id": "media-router",
      "name": "Route Media Type",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.3,
      "position": [
        0,
        0
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "forward",
              "conditions": {
                "options": {
                  "version": 2,
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "rm-fwd",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json._media_type }}",
                    "rightValue": "forward"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "photo",
              "conditions": {
                "options": {
                  "version": 2,
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "loose"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "rm-pht",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json._media_type }}",
                    "rightValue": "photo"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "<uuid>",
      "name": "Save Forwarded Temp",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        200,
        -100
      ],
      "parameters": {
        "schema": "smm_army",
        "tableId": "sent_messages",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "telegram_message_id",
              "fieldValue": "={{ $json.message_id }}"
            },
            {
              "fieldId": "telegram_chat_id",
              "fieldValue": "={{ $json.chat_id }}"
            },
            {
              "fieldId": "message_type",
              "fieldValue": "forwarded_temp"
            },
            {
              "fieldId": "content_data",
              "fieldValue": "={{ JSON.stringify({text: $json.forwarded_content.text, forwarded_date: $json.forwarded_content.forward_date}) }}"
            }
          ]
        },
        "useCustomSchema": true
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "<uuid>",
      "name": "Photo Handler",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        200,
        100
      ],
      "parameters": {
        "jsCode": "const photo = $json.photo;\nconst chatId = $json.chat_id;\nconst messageId = $json.message_id;\n\nif (!photo || !Array.isArray(photo) || photo.length === 0) {\n  throw new Error('No photo found in message');\n}\n\nconst photoFileId = photo[photo.length - 1].file_id;\n\nreturn {\n  json: {\n    chat_id: chatId,\n    message_id: messageId,\n    photo_file_id: photoFileId,\n    action: 'save_and_ask'\n  }\n};"
      }
    },
    {
      "id": "<uuid>",
      "name": "Send Photo Question",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        600,
        100
      ],
      "parameters": {
        "text": "\u041f\u043e\u043b\u0443\u0447\u0438\u043b \u0444\u043e\u0442\u043e. \u0427\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c?",
        "chatId": "={{ $('Photo Handler').first().json.chat_id }}",
        "resource": "message",
        "operation": "sendMessage",
        "additionalFields": {
          "parse_mode": "Markdown",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "<uuid>",
      "name": "Save Photo",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        400,
        100
      ],
      "parameters": {
        "schema": "smm_army",
        "tableId": "sent_messages",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "telegram_message_id",
              "fieldValue": "={{ $json.message_id }}"
            },
            {
              "fieldId": "telegram_chat_id",
              "fieldValue": "={{ $json.chat_id }}"
            },
            {
              "fieldId": "message_type",
              "fieldValue": "photo_temp"
            },
            {
              "fieldId": "content_data",
              "fieldValue": "={{ JSON.stringify({photo_file_id: $json.photo_file_id}) }}"
            }
          ]
        },
        "useCustomSchema": true
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "<uuid>",
      "name": "Save Photo Message",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        800,
        100
      ],
      "parameters": {
        "schema": "smm_army",
        "tableId": "sent_messages",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "telegram_message_id",
              "fieldValue": "={{ $json.result.message_id }}"
            },
            {
              "fieldId": "telegram_chat_id",
              "fieldValue": "={{ $('Photo Handler').first().json.chat_id }}"
            },
            {
              "fieldId": "message_type",
              "fieldValue": "system"
            },
            {
              "fieldId": "content_data",
              "fieldValue": "={{ JSON.stringify({pending_photo: $('Photo Handler').first().json.message_id, question: '\u041f\u043e\u043b\u0443\u0447\u0438\u043b \u0444\u043e\u0442\u043e. \u0427\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c?'}) }}"
            }
          ]
        },
        "useCustomSchema": true
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "<uuid>",
      "name": "Send Question",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        400,
        -100
      ],
      "parameters": {
        "text": "\u0412\u0438\u0436\u0443 \u043f\u0435\u0440\u0435\u0441\u043b\u0430\u043d\u043d\u043e\u0435. \u0427\u0442\u043e \u0441 \u044d\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c?",
        "chatId": "={{ $('When Called by \u0416\u043e\u0440\u0430').first().json.chat_id }}",
        "resource": "message",
        "operation": "sendMessage",
        "additionalFields": {
          "parse_mode": "Markdown",
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "<uuid>",
      "name": "Save Forwarded Message",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        600,
        -100
      ],
      "parameters": {
        "schema": "smm_army",
        "tableId": "sent_messages",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "telegram_message_id",
              "fieldValue": "={{ $json.result.message_id }}"
            },
            {
              "fieldId": "telegram_chat_id",
              "fieldValue": "={{ $('When Called by \u0416\u043e\u0440\u0430').first().json.chat_id }}"
            },
            {
              "fieldId": "message_type",
              "fieldValue": "system"
            },
            {
              "fieldId": "content_data",
              "fieldValue": "={{ JSON.stringify({pending_forwarded: $('When Called by \u0416\u043e\u0440\u0430').first().json.message_id, question: '\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043b \u043f\u0435\u0440\u0435\u0441\u043b\u0430\u043d\u043d\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435. \u0427\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c?'}) }}"
            }
          ]
        },
        "useCustomSchema": true
      },
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When Called by \u0416\u043e\u0440\u0430": {
      "main": [
        [
          {
            "node": "Route Media Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route Media Type": {
      "main": [
        [
          {
            "node": "Save Forwarded Temp",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Photo Handler",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Forwarded Temp": {
      "main": [
        [
          {
            "node": "Send Question",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Question": {
      "main": [
        [
          {
            "node": "Save Forwarded Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Photo Handler": {
      "main": [
        [
          {
            "node": "Save Photo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Photo": {
      "main": [
        [
          {
            "node": "Send Photo Question",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Photo Question": {
      "main": [
        [
          {
            "node": "Save Photo Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "timezone": "Asia/Ho_Chi_Minh",
    "errorWorkflow": "O6BjG1ublqWZ1KWk",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false
  },
  "staticData": null
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

[HUB] Жора Media. Uses executeWorkflowTrigger, supabase, telegram. Event-driven trigger; 9 nodes.

Source: https://github.com/mike-prokhorov/n8n-automation-templates/blob/main/n8n-multi-agent-orchestrator/workflows/04_media.json — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Slack & Telegram

[HUB] Жора Action. Uses executeWorkflowTrigger, supabase, telegram, httpRequest. Event-driven trigger; 19 nodes.

Execute Workflow Trigger, Supabase, Telegram +1
Slack & Telegram

[HUB] Жора Capture. Uses executeWorkflowTrigger, httpRequest, supabase, telegram. Event-driven trigger; 8 nodes.

Execute Workflow Trigger, HTTP Request, Supabase +1
Slack & Telegram

[HUB] Жора Commands. Uses executeWorkflowTrigger, telegram, supabase. Event-driven trigger; 7 nodes.

Execute Workflow Trigger, Telegram, Supabase
Slack & Telegram

This workflow provides a complete solution for handling Telegram Stars payments, invoicing and refunds using n8n. It automates the process of sending invoices, managing pre-checkout approvals, recordi

HTTP Request, Execute Workflow Trigger, Google Sheets +2
Slack & Telegram

This n8n workflow automates task management by integrating Trello, Supabase, and Telegram to streamline card creation, user assignment, and due date notifications. It ensures seamless synchronization

Trello Trigger, Telegram, Supabase +1