You are helping me build the following AI agent workflow. ## Goal Monitor Docker Containers via Telegram: Monitors Docker containers via heartbeat webhooks and lets you check status, restart services. ## Specification - What it does: Get instant Telegram alerts when your Docker containers fail and receive heartbeat status updates without checking logs manually. You can request detailed summaries or restart services directly from chat by simply asking the bot to analyze raw output for you. - Trigger: Triggered by an event (Event ยท on container status change or manual command) - Autonomy: Fully hands-off - Expected setup effort: about an afternoon - Tools/services involved: - Telegram: Receive commands and send notifications - OpenAI: Analyze and summarize container logs - Code: Execute SSH commands to manage containers ## Known pitfalls, handle each one explicitly in your implementation 1. SSH keys may expire or lack permissions, so configure key-based auth with proper read/write access and test connectivity before deployment. 2. Large log dumps can exceed token limits, so truncate logs to the last N lines or stream them in chunks before sending to the LLM. 3. Unsanitized input from chat commands could lead to command injection, validate all user inputs against a strict allowlist of allowed Docker actions. ## Reference implementation https://n8n.io/workflows/10476 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/monitor-docker-containers-via-telegram-bot/ via usecasesforagents.com