π« Create secure human-in-the-loop approval flows with Postgres and Telegram
β‘ 431 views Β· π« Ticket Management & Triage
Description
π Human-in-the-Loop Approval Flow (n8n + Postgres + Telegram)
π₯ Whoβs it for
Teams that need a manager approval step before a ticket or request can change status. Great for internal ops, IT requests, or any workflow where βa human must sign off.β
β‘ What it does
- π¨ Manager receives approval/reject link
- π Link is signed with HMAC + expiry (secure & tamper-proof)
- ποΈ Postgres updates the ticket status
- π Audit trail records every decision
- π² Telegram notifies both manager and requester
- β° Expired or invalid links trigger alerts and logs
π Requirements
- n8n instance (self-hosted)
- Postgres database (with
tickets,ticket_audit,workflow_errors) - Telegram bot token
- One environment variable set:
SECRET_KEY
βοΈ How to set up
- Set
SECRET_KEYin.env - Create Postgres tables (SQL provided)
- Add Telegram + Postgres credentials in n8n
- Import the workflow JSON
- Test by opening an approval/reject link in your browser
π¨ How to customize
- Change who the βmanagerβ is (currently hardcoded in the Code node).
- Swap Telegram for Slack or email notifications.
- Extend the audit schema to include more metadata (IP, username).
π Nodes Used
Postgres, Webhook, Telegram
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File