N8n telegram photo pipeline

Describe the problem/error/question

I have a Telegram bot in n8n. User picks a option from menu, gets prompted to send a photo, sends it. Problem: The photo routes to the wrong pipeline instead of the one matching the user’s menu selection or, the telegram trigger wont register the photo at all
I already have a switch node which routes all my options and even more I have another switch which routes based on the status of the option they chose, so is it a wiring issue or am i missing a node, expertise and experience is most welcome.

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hard to tell without seeing the switch logic, but photo payloads from telegram can look different from text messages. might be missing a field your switch is checking for. what does the condition actually look like? also make sure the webhook is registered in telegram (should see a confirmation callback when you test it)

1 Like

i have 3 switches, workflow is to long to send here. so essentially the workflow is, user sends /start, my bot sends inline keyboard displaying menu option. User presses one of the main menu options, Switch1 handles it and sends the outfit selection keyboard. They pick an outfit, Switch2 catches it, saves their choice to Supabase and tells them to send a photo. in Switch3, it reads the saved status and when user is prompted to send a photo and they do, it is supposed to send that photo down the right pipeline, it either dosen’t register or goes to a different pipeline, . the pictures are in chronological order in regards to which switch is first.



thanks for the detail — that helps a lot. a few things to check:

  1. make sure Switch3 is reading the Supabase result, not the telegram payload. if the switch condition references $json.message or anything from the telegram trigger directly, it won’t see the status you saved

  2. double-check that the user ID used in the Supabase lookup matches what you stored — telegram photo messages use message.from.id, same as text, but worth confirming the lookup field is consistent

  3. for “doesn’t register at all”: telegram photo messages have a photo array instead of a text field. if your trigger filter or any upstream condition checks for text, it’ll silently drop photo updates. you may need a separate branch at the top level that checks message.photo exists before hitting your switch chain

does the Supabase node before Switch3 actually return a row when you test it manually with a photo message?

Telegram has no memory between messages. When the photo arrives, n8n has no idea what the user picked from the menu. Save the menu selection to a DB or static data node with the chat ID as the key, then look it up when the photo trigger fires.

@pvdyck exactly right — and the good news is @aiagentlord is already doing this with Supabase. the key is making sure the Supabase lookup in Switch3 is actually returning the right row for that chat ID when the photo arrives. if the lookup fails or returns empty, the switch won’t route correctly regardless of how it’s wired.

1 Like

The issue is likely that the Telegram trigger fires a separate execution for every message type — text and photo are handled as different events. When the user sends a photo, the trigger doesn’t carry the context of their previous menu selection.

The fix: store the user’s menu choice (e.g. in a static data node or an external key-value store) keyed by chat_id, then retrieve it when the photo arrives. That way you can route the photo correctly regardless of when it comes in.

ive set up supdabase, and a switch node which is supposed to route based on state, but still the workflow ends once it arrives to that switch node.