Quick overview
This workflow listens for Telegram messages and checks German construction delay notices (Behinderungsanzeigen) against § 6 VOB/B by sending text, PDFs, or voice notes to Google Gemini, then replies with a structured analysis in Telegram and can optionally archive the result to Notion.
How it works
- Triggers when a new private Telegram message is received by the bot.
- Validates the sender against an allowlist and checks whether the input is text, a voice note, or a PDF/TXT/CSV document (including size and basic format checks).
- Downloads the voice note or document file from Telegram when applicable, or rejects unsupported/invalid inputs with a Telegram reply.
- Optionally fetches short German terminology background extracts from Wikipedia and appends them as non-authoritative context.
- Sends the prepared content to the Google Gemini API to transcribe voice input (when present) and return a JSON-structured, non-binding § 6 VOB/B completeness and plausibility check.
- Splits the resulting transcript/analysis into Telegram-safe message chunks and sends them back to the user, or returns a neutral error message if processing fails.
- Optionally prepares a combined report and creates a new page in a Notion database (disabled by default).
Setup
- Create/select Telegram bot credentials in n8n and set the same credential on the Telegram trigger, both Telegram file-download steps, and the Telegram reply step.
- Add your allowed Telegram user IDs to the allowlist in the input-validation code so unauthorized users are ignored.
- Configure a public HTTPS base URL for n8n webhooks (for example via a Cloudflare Tunnel) and set N8N_WEBHOOK_URL/WEBHOOK_URL accordingly so Telegram can reach your trigger.
- Add Google Gemini (PaLM) API credentials to the HTTP request step and adjust the model URL if your account requires a different Gemini model that supports audio/PDF input and JSON schema output.
- (Optional) Add Notion API credentials, enter your Notion database ID in the report-prep code, share the database with the Notion integration, and enable the Notion save step.