n8n is a popular open-source workflow automation tool. When you need to automate account registrations or verify emails during a workflow, the missing piece is always the same: how do you receive the OTP?

The Problem with Gmail in n8n

Most n8n users try to connect Gmail via OAuth and poll for new messages. This approach has real problems. Gmail rate limits IMAP connections. Shared inboxes mix test and production emails. And you cannot isolate OTPs per workflow run, which causes collisions when multiple workflows run simultaneously.

A Better Approach: AgentMailr API in n8n

AgentMailr gives each workflow run its own inbox address. Here is the pattern:

  1. HTTP Node (POST): Call POST /v1/inboxes to create a temporary inbox like run-abc123@agentmailr.com.
  2. Use the address: Fill in your signup form with that inbox address.
  3. HTTP Node (GET): Call GET /v1/inboxes/{id}/otp?timeout=60. This long-polls for up to 60 seconds and returns the code the moment it arrives.
  4. Done: Use the OTP in the next step. Delete the inbox if you want cleanup.

n8n HTTP Request Node Config

For the OTP wait node, set the method to GET, the URL to your AgentMailr endpoint, and add your API key as an X-API-Key header. The node will wait until the response arrives. No polling loop, no sleep nodes, no custom code.

Parallel Runs

Because each workflow run creates its own inbox, you can run hundreds of workflows in parallel without OTP collisions. Each run gets exactly one inbox and exactly one OTP.

Get Started

Create a free account at agentmailr.com, grab an API key, and add the HTTP nodes described above. You will have a working OTP workflow in under 10 minutes.