Hi everyone! I’m building a Telegram workflow in n8n that helps me automate internal expense reporting.
Right now, I’m able to successfully send a PDF receipt to the bot on Telegram, and it extracts:
- The invoice date using OCR
- The total amount from the receipt
This part works well
What I’m struggling with
I also want to manually write a message when I send the PDF — something like:
yaml
CopierModifier
activity: restaurant in Paris
card: Valentin’s Revolut
rev trans: 556
What I’m trying to do is:
- Add a Switch to check:
- If the user sends only text, parse the message.
- If the user sends a PDF + text, extract the OCR data and also read the message.
- At the end, I want the bot to send me everything:
- The OCR result (date + amount)
- The user-provided context (activity, card, transaction ID)
not working yet
- The OCR result (date + amount)
The problem
- The workflow can receive a PDF and extract data from it.
- But when I try to include a Switch to check if text is present, it fails to detect the message text.
- It either:
- Treats everything like a document (even if it’s just text),
- Or it ignores the text when a PDF is attached.
I want to find a way to capture both the image and the message text together, or just the message text if there’s no file.
Goal
At the end of the workflow, I want a message like:
yaml
CopierModifier
Activity: restaurant in Paris
Card used: Valentin’s Revolut
Transaction: 556
Date: 29.07.2017
Amount: 240 EUR
Attached
I’ve attached my full workflow JSON below.
Thank you so much for any help or tips