Automation library · Data collection

Build an omnichannel OTP verification flow with Postgres

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

Large

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

The flow

Starts it 1Logic 18Service 14

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

  1. 1WebhookWebhookStarts it
  2. 2Universal normalizationCodeLogic
  3. 3Check if the channel already existsPostgresService
  4. 4IfIfLogic
  5. 5Execute a SQL query3PostgresService
  6. 6Execute a SQL queryPostgresService
  7. 7Channel already verifiedSetLogic
  8. 8Search onboarding_sessionPostgresService
  9. 9If1IfLogic
  10. 10Extract emailCodeLogic
  11. 11IF_step- waiting_otpIfLogic
  12. 12If4IfLogic
  13. 13IF_resend_otpIfLogic
  14. 14If2- extracted_emailIfLogic
  15. 15Greeting 1 - send your emailSetLogic
  16. 16Execute a SQL query1PostgresService
  17. 17Execute a SQL query5PostgresService
  18. 18IF_code_exists?IfLogic
  19. 19Generate OTPCodeLogic
  20. 20valid OTPPostgresService
  21. 21code does not existSetLogic
  22. 22Save OTPPostgresService
  23. 23Execute a SQL query2PostgresService
  24. 24Send emailEmail SendService
  25. 25Get verified session emailPostgresService
  26. 26waiting_for_otpPostgresService
  27. 27If email en sessionIfLogic
  28. 28If2IfLogic
  29. 29Upsert user by emailPostgresService
  30. 30Missing email responseSetLogic
  31. 31response_message1 - verification code sentSetLogic
  32. 32Upsert user_channelPostgresService
  33. 33Verification completed responseSetLogic

How it's built

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

Questions

What does it need to run?

An n8n account, plus your own Email and Postgres 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 33 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 33 steps before you point it at anything that matters.