# Build an omnichannel OTP verification flow with Postgres: n8n workflow

> 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...

Source: https://millionrounds.com/workflow/build-an-omnichannel-otp-verification-flow-with-postgres (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Data collection](https://millionrounds.com/workflows?category=Data+collection#library)

# 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

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fbuild-an-omnichannel-otp-verification-flow-with-postgres)

**33 steps** Large: read it before trusting it with anything live

**9** Branches: places the flow splits

**0** Loops or waits

**2** Services it connects to

## The flow

Starts it 1 Logic 18 Service 14

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

- 1 **Webhook** Webhook *Starts it*
- 2 **Universal normalization** Code *Logic*
- 3 **Check if the channel already exists** Postgres *Service*
- 4 **If** If *Logic*
- 5 **Execute a SQL query3** Postgres *Service*
- 6 **Execute a SQL query** Postgres *Service*
- 7 **Channel already verified** Set *Logic*
- 8 **Search onboarding_session** Postgres *Service*
- 9 **If1** If *Logic*
- 10 **Extract email** Code *Logic*
- 11 **IF_step- waiting_otp** If *Logic*
- 12 **If4** If *Logic*
- 13 **IF_resend_otp** If *Logic*
- 14 **If2- extracted_email** If *Logic*
- 15 **Greeting 1 - send your email** Set *Logic*
- 16 **Execute a SQL query1** Postgres *Service*
- 17 **Execute a SQL query5** Postgres *Service*
- 18 **IF_code_exists?** If *Logic*
- 19 **Generate OTP** Code *Logic*
- 20 **valid OTP** Postgres *Service*
- 21 **code does not exist** Set *Logic*
- 22 **Save OTP** Postgres *Service*
- 23 **Execute a SQL query2** Postgres *Service*
- 24 **Send email** Email Send *Service*
- 25 **Get verified session email** Postgres *Service*
- 26 **waiting_for_otp** Postgres *Service*
- 27 **If email en session** If *Logic*
- 28 **If2** If *Logic*
- 29 **Upsert user by email** Postgres *Service*
- 30 **Missing email response** Set *Logic*
- 31 **response_message1 - verification code sent** Set *Logic*
- 32 **Upsert user_channel** Postgres *Service*
- 33 **Verification completed response** Set *Logic*

## 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.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fbuild-an-omnichannel-otp-verification-flow-with-postgres)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Email](https://millionrounds.com/workflows?service=Email#library)[Postgres](https://millionrounds.com/workflows?service=Postgres#library)

## Workflows like it

Also data collection, with the same services where possible, closest in size first.

- [**AI chatbot call center: Taxi service with Grok and Postgres** 33 steps · calls a model · Postgres, Redis](https://millionrounds.com/workflow/ai-chatbot-call-center-taxi-service-with-grok-and-postgres)
- [**Import E.ON W1000 energy meter data to Home Assistant** 32 steps · Email, Gmail](https://millionrounds.com/workflow/import-e-on-w1000-energy-meter-data-to-home-assistant)
- [**Create a self-updating RAG chatbot with Google Drive** 34 steps · calls a model · Google Drive, Postgres](https://millionrounds.com/workflow/create-a-self-updating-rag-chatbot-with-google-drive)
- [**Find and score event and speaker opportunities with Gumloop** 35 steps · Gmail, Postgres](https://millionrounds.com/workflow/find-and-score-event-and-speaker-opportunities-with-gumloop)
- [**From sitemap crawling to vector storage: Creating an efficient** 35 steps · calls a model · Postgres, Supabase](https://millionrounds.com/workflow/from-sitemap-crawling-to-vector-storage-creating-an-efficien)
- [**Passbolt API - password export** 30 steps · Email](https://millionrounds.com/workflow/passbolt-api-password-export)
