Playground API
DocsStatsBlogStudio
Documentation Tree
Technical BlogFeature Deep Dives
  • Introduction
  • Quickstart
    5 min
  • How It Works
  • Recipes & Cookbooks
  • Platform Comparisons
  • Real-World Showcase
  • Interactive Studio
    Studio
  • GraphiQL IDE
    IDE
  • Session Quotas & Activity
  • Network Chaos Simulator
  • Atomic Sandbox Reset
  • Overview & Models
    Hub
  • Users Resource
  • Posts Resource
  • Comments Resource
  • Todos Resource
  • Custom Collections
    Custom
  • Multipart File Uploads
    Upload
  • Dynamic SVG Avatars
    SVG
  • Image Thumbnails
    CDN
  • Relational Filtering
  • Full-Text Search
  • Dynamic Sorting
  • Offset Pagination
  • Cursor Pagination
    Scroll
  • CSV & Excel Export & Import
    IO
  • Custom Collections
    CRUD
  • Overview & Architecture
    Hub
  • JWT Auth Flow
  • Refresh Token Rotation
    Mutex
  • RBAC Permission Matrix
    Roles
  • Expiry Simulation
  • Clock Skew Drift
  • Password Recovery Loop
  • Dual-Mode Sandboxing
  • GraphiQL IDE
    IDE
  • Relational Queries
  • Stateful Mutations
  • Realtime Subscriptions
  • Overview & Flowcharts
    Hub
  • Hosted Checkout
    Stripe
  • Payment Intents API
  • 3DS Challenge Modal
    Modal
  • Customers Vault
  • Charges & Refunds
  • Test Cards Catalog
  • Overview & Channels
    Hub
  • Virtual Email Mailbox
    Mailtrap
  • Virtual SMS Terminal
    Phone
  • In-App Notifications
  • Message Dispatcher
  • Realtime Studio
    Studio
  • Native WebSocket (/ws)
  • Socket.io Gateway
  • Presence & Echo Bot
  • Server-Sent Events (SSE)
    SSE
  • Analytics Telemetry
  • Webhook Subscriptions
  • HMAC SHA-256 Signatures
  • Delivery Logs
  • Manual Retry Simulator
  • Network Latency Delay
  • HTTP Status Codes
  • Rate-Limit Simulator
    429
  • Flaky Network & Jitter
    Chaos
  • Session Quotas & Activity
  • JSON Snapshots
    JSON
  • Headless CI/CD Testing
    CI
  • Mobile QR Code Sync
  • System Metrics & Health
  • Atomic Sandbox Reset
  • Official TypeScript SDK
  • Multi-Language Generators
  • DevTools Extension
  • OpenAPI 3.1 Spec
    JSON
  • Postman Collection v2.1
  • Bruno Collection
  • Insomnia Workspace
  • TypeScript .d.ts
    .d.ts
  • AI Prompt Rules
    Rules
  • Context Index (llms.txt)
  • Full Schema (llms-full.txt)
  • Manifest (product.json)
  • All Feature Articles
    Blog
  • React CRUD Without Backend
    Deep Dive
  • Why Static APIs Fail
  • Mocking Stateful Auth
  • WebSockets & SSE Guide
Technical Blog
Articles

In-depth articles explaining stateful mock APIs, WebSockets, payments, and frontend resilience.

Read Articles
PreviousTest Cards Catalog
NextVirtual Email Mailbox
Virtual Communications Platform

Virtual Inboxes, SMS & Transactional Messaging

A sandboxed communications hub for testing authentication loops, transactional notifications, and customer journeys. Intercept emails, receive verification SMS messages, broadcast in-app feeds, and automate CI/CD assertions—zero third-party credentials required.

Setup Required

Zero

100% In-Memory Sandbox
Real-Time Delivery

< 10ms

SSE & Native WebSockets
Built-In Templates

4 Blueprints

OTP, Receipt, Reset, 2FA
E2E CI/CD Assertions

1 Endpoint

GET /emails/otp
Virtual Email Mailbox & SMS OTP Interception Lifecycle
Messaging Engine
Playground API Virtual Email Mailbox and SMS Verification OTP Interception Engine Workflow Diagram
Click to expand full architecture
Outbound communications capture: Intercept transactional emails and SMS verification codes in memory without external third-party SMTP/Twilio credentials.Interactive High-Resolution Flowchart
1Zero SMTP

Transactional Trigger

Client initiates password reset or 2FA request without configuring external email APIs.

2Regex Parsing

Sandbox Interception & Regex

Parses HTML email body and SMS payload to extract single-use 6-digit OTP codes.

3Automated E2E

Virtual Mailbox & CI Assertions

Inspect message visually in HTML terminal or query GET /api/v1/emails/otp in CI/CD.

How It Works Under the HoodExplore Communication ChannelsChannel Comparison MatrixCI/CD Test Automation

How Virtual Email & Communications Work Under the Hood

Understanding the zero-SMTP interception lifecycle from event trigger to headless test assertion.

1. TRIGGER

Dual Ingestion

Emails originate either from direct REST calls (POST /emails/send) or automated system events (e.g. checkout receipts and auth password resets).

2. COMPILE & PARSE

Smart Extraction

The engine interpolates Mustache variables ({{name}}) and runs regex parsers to extract 6-digit OTP codes and magic links into JSON fields.

3. ISOLATE

Zero-SMTP Sandbox

No emails touch real mail servers or spam filters. Messages are saved strictly in your isolated visitor sandbox overlay with simulated SPF/DKIM verification tags.

4. CONSUME

Real-Time Delivery

Delivered immediately via SSE/WebSockets to the virtual mailbox UI, or asserted instantly in CI/CD suites using GET /emails/otp?to=....

Communication Channels & Tools

Four specialized endpoints for intercepting, inspecting, and managing transactional developer communications.

Mailtrap Style

Virtual Email Mailbox

Full-fidelity transactional inbox. Intercepts welcome emails, password resets, receipts, and 2FA codes with isolated HTML rendering, attachment downloads, and security header validation.

Primary Endpoint:
GET /api/v1/emails
Twilio Compatible

Virtual SMS Terminal

Simulate mobile phone number verification, 2FA security codes, and outbound SMS notifications without real carrier charges or Twilio credentials.

Primary Endpoint:
GET /api/v1/sms
User Feed

In-App Notifications Feed

Push system notifications, promotional announcements, and maintenance alerts. Test unread count badges, priority tags, and actionable deep-link redirects.

Primary Endpoint:
GET /api/v1/messages
Multi-Channel

Dispatcher & Template Engine

Manage reusable Mustache-style template blueprints with dynamic variable interpolation (e.g. {{name}}, {{otp}}), cross-channel broadcasting, and 1-click mailbox purging.

Primary Endpoint:
GET /api/v1/emails/templates

Channel Matrix & Protocol Capabilities

Understanding data transports, real-time sync pipelines, and supported payload structures.

ChannelProtocol & InterfaceSupported PayloadReal-Time TransportTypical Use Cases
Virtual EmailREST / SMTP ProxyHTML, Plain Text, AttachmentsSSE (email.received) & WebSocketAccount activation, password reset links, order receipts
Virtual SMSREST / Carrier EmulationUTF-8 Text, 6-digit OTP codesSSE (sms.received) & WebSocketMobile 2FA authentication, shipment tracking alerts
In-App NotificationsREST / Toast StreamJSON { title, priority, actionUrl, read }SSE & Real-Time SyncProduct announcements, background job completion banners
Template DispatcherTemplate EngineMustache {{variable}} JSON dataMulti-Channel PushConsistent cross-platform branding & automated notification testing

Headless CI/CD & E2E Test Automation

How to verify account activation, OTP email verification, and order receipts in Playwright, Cypress, and automated test suites.

Playwright E2E Test (Extract OTP & Submit Form)

typescript
1
import { test, expect } from '@playwright/test';
2
3
test('completes signup with 6-digit email OTP', async ({ page }) => {
4
const testEmail = qa_${Date.now()}@example.com;
5
6
// 1. Submit registration form in your app
7
await page.goto('/signup');
8
await page.fill('input[name="email"]', testEmail);
9
await page.click('button[type="submit"]');
10
11
// 2. Poll Playground API for the auto-extracted OTP code
12
const otpRes = await fetch(https://playground.nileslabs.com/api/v1/emails/otp?to=${testEmail}`);
13
const { otp } = await otpRes.json();
14
expect(otp).toHaveLength(6);
15
16
// 3. Enter OTP code into verification screen
17
await page.fill('input[name="otp"]', otp);
18
await page.click('button:has-text("Verify")');
19
20
// 4. Assert user is logged into dashboard
21
await expect(page).toHaveURL('/dashboard');
22
});

Cypress Custom Command (Email Assertion)

javascript
1
// cypress/support/commands.js
2
Cypress.Commands.add('getLatestEmailOtp', (recipientEmail) => {
3
return cy.request({
4
method: 'GET',
5
url: https://playground.nileslabs.com/api/v1/emails/otp?to=${recipientEmail}`,
6
}).then((response) => {
7
expect(response.status).to.eq(200);
8
return response.body.otp;
9
});
10
});
11
12
// In your spec file:
13
it('verifies password reset flow', () => {
14
cy.visit('/forgot-password');
15
cy.get('#email').type('buyer@example.com');
16
cy.get('#submit-btn').click();
17
18
cy.getLatestEmailOtp('buyer@example.com').then((otp) => {
19
cy.get('#otp-code').type(otp);
20
cy.get('#confirm-btn').click();
21
cy.contains('Password reset successfully').should('be.visible');
22
});
23
});