Automation library · Content

Create secure human-in-the-loop approval flows with Postgres

Started by another system calling it, and works across Postgres and Telegram. 21 steps, 5 branches: large, and worth reading before you trust it with anything live.

Large

21 stepsLarge: read it before trusting it with anything live
5Branches: places the flow splits
0Loops or waits
2Services it connects to

The flow

Starts it 1Logic 6Service 14

The steps in the order they run, from what starts it.

  1. 101 Webhook Trigger: Approval DecisionWebhookStarts it
  2. 202 FN: Verify Signature + TTLCodeLogic
  3. 3ActionsSwitchLogic
  4. 404c DB: Update Ticket StatusPostgresService
  5. 504r0 DB: Get Ticket IDPostgresService
  6. 604e DB: Insert Audit ExpiredPostgresService
  7. 704i DB: Insert Audit InvalidPostgresService
  8. 804c2 DB: Insert Audit RowPostgresService
  9. 9Execute a SQL query1PostgresService
  10. 1005e Telegram: Notify ExpiredTelegramService
  11. 1105i Telegram: Alert InvalidTelegramService
  12. 1204c1 DB: Get Ticket OwnerPostgresService
  13. 13Text (reject)TelegramService
  14. 1404c1a IF: Resolved or In ProgressIfLogic
  15. 1505c Telegram: Update ConfirmationTelegramService
  16. 16If ResolvedIfLogic
  17. 17If in_progressIfLogic
  18. 1805c1a Telegram: Notify ResolvedTelegramService
  19. 1905c1b Telegram: Notify In ProgressTelegramService
  20. 20Notify Failed?IfLogic
  21. 21Execute a SQL queryPostgresService

How it's built

Starts on
Another system calling it
Steps
21, with 5 branches
Size
Large: read it before trusting it with anything live
Connects to
Postgres, Telegram
Model
None. This is plumbing, not judgement

Questions

What does it need to run?

An n8n account, plus your own Postgres and Telegram accounts. You connect your own accounts after importing it; none are included.

What starts it?

It starts on another system calling it.

Does it use AI?

No. Every step is fixed logic or a call to a service, so it does the same thing every time.

How long does it take to set up?

Take your time. At 21 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 21 steps before you point it at anything that matters.