Developer Quick-Start: Build production-ready SMS OTP and two-factor authentication in NestJS using MessageBird Verify API. Step-by-step TypeScript tutorial with code examples, error handling, and security best practices. Want to skip 10DLC vetting queues, carrier surcharges, and multi-step SDK boilerplate? You can send the same SMS directly via SMSRoute's REST API with instant no-KYC provisioning.
Integrate MessageBird's Verify API into your NestJS application to implement robust SMS-based Two-Factor Authentication (2FA) or phone number verification using One-Time Passwords (OTPs). This guide shows you how to build a secure, scalable backend API that sends OTPs via SMS and verifies user-submitted tokens.
Project Overview and Goals
What You'll Build:
- NestJS application with dedicated endpoints for initiating OTP requests and verifying submitted tokens
- Integration with the MessageBird Verify API via their official Node.js SDK
- Secure API key handling using NestJS configuration modules
- Input validation for phone numbers and tokens
- Robust error handling for common scenarios
Problem This Solves:
Verify user phone numbers and add a 2FA layer to your application. This prevents fraudulent account creation, secures accounts against unauthorized access, and verifies transactions by confirming control over a registered phone number. Common use cases include e-commerce checkout verification, financial transaction confirmation, and account recovery flows.
Technologies You'll Use:
- Node.js: JavaScript runtime environment
- NestJS: Progressive Node.js framework for building efficient, reliable, and scalable server-side applications with modular architecture and dependency injection
- MessageBird: Third-party service provider for sending SMS OTPs via their Verify API
- MessageBird Node.js SDK: Simplifies interaction with the MessageBird API
- TypeScript: Provides static typing for enhanced code quality and maintainability
- (Optional) Prisma: Modern ORM for database interaction (not required for basic OTP flow)
System Architecture:
graph LR
A[User Client (Web/Mobile)] -- 1. Request OTP (POST /otp/send) --> B(NestJS API);
B -- 2. Call OtpService.sendOtp --> C(OtpService);
C -- 3. Call MessageBird SDK (verify.create) --> D(MessageBird Verify API);
D -- 4. Send SMS OTP --> E[User's Phone];
D -- 5. Return Verification ID --> C;
C -- 6. Return Verification ID --> B;
B -- 7. Send Verification ID back --> A;
A -- 8. Submit Token & ID (POST /otp/verify) --> B;
B -- 9. Call OtpService.verifyOtp --> C;
C -- 10. Call MessageBird SDK (verify.verify) --> D;
D -- 11. Return Verification Status --> C;
C -- 12. Return Status --> B;
B -- 13. Send Verification Result back --> A;
style B fill:#f9f,stroke:#333,stroke-width:2px
style C fill:#ccf,stroke:#333,stroke-width:2px
style D fill:#ff9,stroke:#333,stroke-width:2px
Prerequisites:
Install these requirements before starting:
- Node.js: Install LTS version v22 (Active LTS) or v20 (Maintenance LTS) recommended as of 2025. Node.js 18 reaches end-of-life April 2025.
- MessageBird Account: Sign up and obtain API credentials (both test and live keys)
- Knowledge: Basic understanding of TypeScript, NestJS concepts (modules, controllers, services), REST APIs, and authentication flows
- NestJS CLI: Install globally with npm install -g @nestjs/cli (NestJS v10+ requires Node.js v16 or higher)
- (Optional) Docker: For database setup if using Prisma
- (Optional) PostgreSQL: Local or cloud-based database instance
Final Outcome:
Build a functional NestJS API that:
- Accepts a phone number via POST request
- Sends an SMS OTP to that number using MessageBird
- Returns a unique verification ID to the client
- Accepts the verification ID and user-submitted OTP via another POST request
- Verifies the token against the ID using MessageBird
- Returns success or failure status to the client
After successful verification, integrate this into your full authentication flow by issuing JWT tokens or creating user sessions.
1. Setting Up the Project
Initialize a new NestJS project and install the necessary dependencies.
- Create Your NestJS Project: Run the NestJS CLI command to create a new project named
nestjs-messagebird-otp.
nest new nestjs-messagebird-otp
Choose your preferred package manager (npm or yarn) when prompted.
- Navigate to Your Project Directory:
cd nestjs-messagebird-otp
- Install Required Dependencies: Install these essential packages:
- @nestjs/config: Manages environment variables
- messagebird: Official MessageBird Node.js SDK (v4.0.1, last updated 2022 β monitor for alternatives if maintenance becomes a concern)
- class-validator, class-transformer: Validate request data using DTOs
npm install @nestjs/config messagebird class-validator class-transformer
yarn add @nestjs/config messagebird class-validator class-transformer
Package Versions (as of 2025):
- messagebird: v4.0.1 (last published 3 years ago β check for security vulnerabilities before production deployment)
- @nestjs/config: Compatible with NestJS v10+ and v11
- NestJS v11.1.6 is the latest stable version
Security Note: The MessageBird SDK hasn't been updated since 2022. Before production deployment, check for known CVEs and consider alternatives like direct REST API integration or maintained community SDKs.
- (Optional) Install Prisma Dependencies: If you plan to integrate with a database (e.g., to link verified numbers to users), install Prisma. This section is optional for the core OTP functionality.
npm install prisma @prisma/client --save-dev
yarn add prisma @prisma/client --dev
- Project Structure: Key directories:
- src/: Application source code (main.ts, app.module.ts, etc.)
- src/otp/: Module for OTP logic (you'll create this)
- .env: Environment variables (you'll create this)
- (Optional) prisma/: Prisma schema and migrations
2. Environment Configuration
Securely manage API keys using the @nestjs/config module and a .env file. For
production, use secret managers like AWS Secrets Manager, Azure Key Vault, or HashiCorp Vault instead of plain
.env files.
- Create
.envfile: Create a file named.envin the project's root directory. - Add MessageBird API Key: Obtain your API keys from the MessageBird Dashboard:
- Log in to your MessageBird account.
- Navigate to the Developers section in the left sidebar.
- Go to the API access (REST) tab.
- You'll find both Live and Test API keys.
- Test Key: Use during development and testing. Simulates API calls without sending actual SMS messages or incurring costs. Test against specific MessageBird test numbers.
- Live Key: Use in production to send real SMS messages to users.
- Add the key you intend to use (start with the test key) to your .env file:
.env
# .env
# Use your TEST key for development, switch to LIVE key for production
MESSAGEBIRD_API_KEY=YOUR_TEST_API_KEY_HERE
Replace YOUR_TEST_API_KEY_HERE with your actual test key initially. Switch to the live key in
your production environment. Purpose: This variable holds the secret key required to
authenticate requests to the MessageBird API. Using test keys avoids costs and real messages during
development.
- (Optional) Add Database URL: If using Prisma (optional feature), add your database connection string:
.env
# .env (Optional - only if using Prisma)
# Example for PostgreSQL: postgresql://USER:PASSWORD@HOST:PORT/DATABASE
DATABASE_URL="postgresql://postgres:password@localhost:5432/otp_app?schema=public"
Adjust the URL according to your database credentials and provider. Purpose: This variable tells Prisma how to connect to your database.
- Load
ConfigModule: Import and configureConfigModulein your main application module (src/app.module.ts) to make environment variables available throughout the app viaConfigService. Make it global and load.envvariables.
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { OtpModule } from './otp/otp.module';
@Module({
imports: [
ConfigModule.forRoot({
isGlobal: true,
}),
OtpModule,
],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
Why isGlobal: true? This makes the ConfigService available in any
module without needing to import ConfigModule repeatedly.
3. Implementing Core Functionality (OTP Service)
Create a dedicated module and service to handle the logic of interacting with the MessageBird API.
- Generate OTP Module and Service: Use the NestJS CLI to generate the
otpmodule and service.
nest generate module otp
nest generate service otp
This creates src/otp/otp.module.ts and src/otp/otp.service.ts (and spec file).
NestJS automatically updates src/app.module.ts to import OtpModule.
- Implement
OtpService: Opensrc/otp/otp.service.ts. InjectConfigServiceto access the API key and instantiate the MessageBird client.
import { Injectable, InternalServerErrorException, BadRequestException, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import * as MessageBird from 'messagebird';
@Injectable()
export class OtpService {
private readonly logger = new Logger(OtpService.name);
private messagebird: MessageBird.MessageBird;
constructor(private configService: ConfigService) {
const apiKey = this.configService.get<string>('MESSAGEBIRD_API_KEY');
if (!apiKey) {
throw new Error('MessageBird API Key not found in environment variables.');
}
this.messagebird = MessageBird(apiKey) as unknown as MessageBird.MessageBird;
}
async sendOtp(phoneNumber: string): Promise<string> {
const normalizedPhoneNumber = phoneNumber.replace(/[\s\-()]/g, '');
this.logger.log(`Sending OTP to normalized number: ${normalizedPhoneNumber}`);
const params: MessageBird.VerifyCreateParams = {
originator: 'VerifyApp',
template: 'Your verification code is %token.',
type: 'sms',
};
return new Promise((resolve, reject) => {
this.messagebird.verify.create(normalizedPhoneNumber, params, (err, response) => {
if (err) {
this.logger.error('MessageBird verify.create error:', JSON.stringify(err));
if (err.errors && err.errors.length > 0) {
const mbError = err.errors[0];
this.logger.error(`MessageBird Error Code: ${mbError.code}, Description: ${mbError.description}`);
if (mbError.code === 21) {
return reject(new BadRequestException(`Invalid phone number: ${mbError.description}`));
}
return reject(new BadRequestException(`Failed to send OTP: ${mbError.description}`));
}
return reject(new InternalServerErrorException('Failed to initiate OTP verification due to an unexpected error.'));
}
this.logger.log(`OTP request successful for ${normalizedPhoneNumber}. ID: ${response?.id}`);
if (response && typeof response.id === 'string') {
resolve(response.id);
} else {
this.logger.error('MessageBird verify.create response missing or invalid ID:', response);
reject(new InternalServerErrorException('Failed to get a valid verification ID from MessageBird.'));
}
});
});
}
async verifyOtp(id: string, token: string): Promise<{ status: string }> {
this.logger.log(`Verifying OTP for ID: ${id}`);
return new Promise((resolve, reject) => {
this.messagebird.verify.verify(id, token, (err, response) => {
if (err) {
this.logger.error(`MessageBird verify.verify error for ID ${id}:`, JSON.stringify(err));
if (err.errors && err.errors.length > 0) {
const mbError = err.errors[0];
this.logger.error(`MessageBird Verify Error Code: ${mbError.code}, Description: ${mbError.description}`);
if (mbError.code === 10) {
return reject(new BadRequestException('Invalid or expired OTP token.'));
}
return reject(new BadRequestException(`Failed to verify OTP: ${mbError.description}`));
}
return reject(new InternalServerErrorException('Failed to verify OTP due to an unexpected error.'));
}
if (response && response.status === 'verified') {
this.logger.log(`OTP verification successful for ID: ${id}`);
resolve({ status: 'verified' });
} else {
this.logger.warn(`OTP verification for ID ${id} returned non-verified status: ${response?.status ?? 'unknown'}`);
reject(new BadRequestException('Invalid or expired OTP token.'));
}
});
});
}
}
Key Implementation Details:
- Why
new Promise? The MessageBird SDK uses callbacks. Wrap the callback logic in a Promise to work seamlessly with NestJS's async/await syntax. - Error Handling: Catch errors from the SDK. Throw BadRequestException for known user-input issues or specific MessageBird error codes (like invalid number code 21, invalid token code 10). Use InternalServerErrorException for unexpected API failures or missing IDs. Logging the full error (JSON.stringify(err)) and specific codes helps diagnose issues.
- Configuration: originator should ideally be a purchased virtual number from MessageBird or a short alphanumeric code (max 11 characters, check country-specific restrictions). template must include the %token placeholder (verified from MessageBird Verify API documentation at https://developers.messagebird.com/api/verify/).
- Normalization: The basic regex phoneNumber.replace(/[\\s\\-()]/g, '') strips common characters before sending to MessageBird. For production, use a robust phone number library like libphonenumber-js for comprehensive E.164 format validation and normalization, especially for international formats and country-specific validation.
- API Parameters: Based on MessageBird Verify API official documentation (https://developers.messagebird.com/api/verify/):
- timeout: Range 30β172,801 seconds (default: 30s)
- tokenLength: Range 6β10 digits (default: 6)
- maxAttempts: Range 1β10 attempts (default: 1)
- type: Options are sms, flash, tts (text-to-speech), or email
Common MessageBird Error Codes:
- Code 10: Invalid or expired OTP token
- Code 21: Invalid phone number format
- Code 9: Missing required parameter
- Register
ConfigServiceinOtpModule: SinceConfigModuleis global andConfigServiceis injected intoOtpService(which is part ofOtpModule), no explicit import ofConfigModuleor registration ofConfigServiceis needed withinOtpModuleitself.
import { Module } from '@nestjs/common';
import { OtpService } from './otp.service';
import { OtpController } from './otp.controller';
@Module({
controllers: [OtpController],
providers: [OtpService],
exports: [OtpService],
})
export class OtpModule {}
4. Building the API Layer (OTP Controller)
Create the controller with endpoints that clients can call. Protect these endpoints with rate limiting and authentication in production.
- Generate OTP Controller:
nest generate controller otp
This creates src/otp/otp.controller.ts (and spec file) and adds it to OtpModule.
- Define Data Transfer Objects (DTOs): Create DTOs to define the expected request body
structure and apply validation rules using
class-validator.
- Create
src/otp/dto/send-otp.dto.ts:
import { IsNotEmpty, IsPhoneNumber, IsString } from 'class-validator';
export class SendOtpDto {
@IsNotEmpty()
@IsString()
@IsPhoneNumber(null)
phoneNumber: string;
}
About @IsPhoneNumber: This validator accepts E.164 format phone numbers (e.g., +14155552671) but has limitations with formatting variations. Service-level normalization remains necessary to handle spaces, dashes, and parentheses that users might include.
- Create
src/otp/dto/verify-otp.dto.ts:
import { IsNotEmpty, IsString, Length } from 'class-validator';
export class VerifyOtpDto {
@IsNotEmpty()
@IsString()
id: string;
@IsNotEmpty()
@IsString()
@Length(6, 6)
token: string;
}
- Implement
OtpController: Opensrc/otp/otp.controller.ts. InjectOtpServiceand define the endpoints.
import { Controller, Post, Body, HttpCode, HttpStatus, ValidationPipe, UsePipes, Logger } from '@nestjs/common';
import { OtpService } from './otp.service';
import { SendOtpDto } from './dto/send-otp.dto';
import { VerifyOtpDto } from './dto/verify-otp.dto';
@Controller('otp')
export class OtpController {
private readonly logger = new Logger(OtpController.name);
constructor(private readonly otpService: OtpService) {}
@Post('send')
@HttpCode(HttpStatus.OK)
async sendOtp(@Body() sendOtpDto: SendOtpDto): Promise<{ id: string }> {
this.logger.log(`Received request to send OTP to ${sendOtpDto.phoneNumber}`);
const verificationId = await this.otpService.sendOtp(sendOtpDto.phoneNumber);
return { id: verificationId };
}
@Post('verify')
@HttpCode(HttpStatus.OK)
async verifyOtp(@Body() verifyOtpDto: VerifyOtpDto): Promise<{ status: string }> {
this.logger.log(`Received request to verify OTP for ID: ${verifyOtpDto.id}`);
return this.otpService.verifyOtp(verifyOtpDto.id, verifyOtpDto.token);
}
}
Endpoint Details:
@Controller('otp'): Sets the base route for all methods in this controller to /otp@Post('send'),@Post('verify'): Define POST endpoints at /otp/send and /otp/verify@Body(): Injects the request bodyValidationPipe: (Applied globally below) Automatically validates the incoming request body against the DTO@HttpCode(HttpStatus.OK): Ensures a 200 OK status is returned on success
Production Security:
- Implement rate limiting to prevent abuse (use @nestjs/throttler package)
- Add authentication to protect endpoints (JWT tokens, API keys)
- Track OTP request attempts per IP and phone number
- Implement cooldown periods between OTP requests
- Enable
ValidationPipeGlobally (Recommended): Enable the validation pipe globally insrc/main.tsfor cleaner controllers.
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { ValidationPipe, Logger } from '@nestjs/common';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const logger = new Logger('Bootstrap');
app.useGlobalPipes(new ValidationPipe({
whitelist: true,
transform: true,
forbidNonWhitelisted: true,
transformOptions: {
enableImplicitConversion: true,
},
}));
app.enableCors();
logger.log('CORS enabled. Remember to restrict origins in production.');
const port = process.env.PORT || 3000;
await app.listen(port);
logger.log(`Application listening on port ${port}`);
}
bootstrap();
With the global pipe enabled, remove the @UsePipes(...) decorators from the controller methods
(as shown in the controller example above). Production Deployment Checklist:
- Install helmet for security headers
- Enable compression middleware
- Configure structured logging (Pino recommended)
- Add health check endpoints
- Implement graceful shutdown
- Use environment-specific configurations
- Set up centralized logging (CloudWatch, Datadog, etc.)
- Testing Endpoints with
curl:
- Start the application:
npm run start:dev - Send OTP: Replace
+12345678900with a real phone number (use a test number if using your test API key).
curl -X POST http://localhost:3000/otp/send \
-H "Content-Type: application/json" \
-d '{
"phoneNumber": "+12345678900"
}'
Expected Response (Success):
{
"id": "some-verification-id-from-messagebird"
}
Expected Response (Validation Error β e.g., invalid number format):
{
"statusCode": 400,
"message": [
"phoneNumber must be a valid phone number"
],
"error": "Bad Request"
}
- Verify OTP: Replace
some-verification-id-from-messagebirdwith the ID you received, and123456with the code sent to your phone (or the test code provided by MessageBird if using test keys).
curl -X POST http://localhost:3000/otp/verify \
-H "Content-Type: application/json" \
-d '{
"id": "some-verification-id-from-messagebird",
"token": "123456"
}'
Expected Response (Success):
{
"status": "verified"
}
Expected Response (Incorrect Token):
{
"statusCode": 400,
"message": "Invalid or expired OTP token.",
"error": "Bad Request"
}
5. Integrating with Third-Party Services (MessageBird)
Core integration points:
- Configuration: Store API key securely in .env (use Test key for dev, Live key for prod) and load via @nestjs/config. Ensure the .env file is never committed to version control (add it to .gitignore).
- SDK Initialization: Initialize the messagebird SDK in the OtpService constructor using the API key from ConfigService. The type assertion as unknown as MessageBird.MessageBird is included due to potential SDK typing nuances.
- API Calls: Use verify.create and verify.verify methods within OtpService to interact with MessageBird.
- Dashboard Navigation for API Key: MessageBird Dashboard β Developers β API access (REST) β Copy/Create Test and Live API Keys.
- Fallback Mechanisms: The current implementation relies directly on MessageBird. For production robustness:
- Retries: Implement retry logic (see Section 6) within OtpService around the MessageBird calls, especially for transient network errors (distinguish from user errors like invalid tokens).
- Alternative Providers: Consider integrating a secondary SMS provider as a fallback if MessageBird experiences prolonged outages (adds complexity).
- Voice Fallback: MessageBird Verify supports type: 'tts' (Text-to-Speech). Modify sendOtp to offer this if SMS fails or as a preference.
MessageBird Pricing Considerations:
- SMS costs vary by destination country
- Test API keys don't incur charges
- Monitor usage to stay within budget
- Consider volume pricing tiers for scaling
Geographic Coverage: MessageBird supports SMS delivery to 200+ countries. Check country-specific restrictions and compliance requirements (e.g., sender ID registration, content filtering) before deploying internationally.
6. Implementing Error Handling and Logging
NestJS provides robust mechanisms for handling errors and logging.
- Error Handling Strategy:
- Validation Errors: The global ValidationPipe handles these automatically, returning 400 Bad Request.
- Service-Level Errors: OtpService throws specific HttpException subclasses (BadRequestException, InternalServerErrorException) based on MessageBird API responses or internal issues. Specific MessageBird error codes (e.g., 10, 21) map to BadRequestException.
- Unhandled Errors: NestJS catches unhandled exceptions and returns 500 Internal Server Error.
Custom Exception Filters: Create custom exception filters to format error responses consistently or integrate with error tracking services like Sentry. Example:
import { ExceptionFilter, Catch, ArgumentsHost, HttpException } from '@nestjs/common';
import { Response } from 'express';
@Catch(HttpException)
export class HttpExceptionFilter implements ExceptionFilter {
catch(exception: HttpException, host: ArgumentsHost) {
const ctx = host.switchToHttp();
const response = ctx.getResponse<Response>();
const status = exception.getStatus();
response.status(status).json({
statusCode: status,
timestamp: new Date().toISOString(),
message: exception.message,
});
}
}
- Logging:
- Use the built-in Logger (@nestjs/common) in OtpService, OtpController, and main.ts.
- NestJS logs basic request/response info and exceptions. OtpService logs specific MessageBird errors.
- Production Best Practices:
- Use structured logging (pino, nestjs-pino) for easier parsing by log aggregation tools
- Include correlation IDs for request tracing
- Redact PII (Personal Identifiable Information) like phone numbers in logs
- Configure appropriate log levels (debug, info, warn, error)
- Implement log rotation
- Use centralized logging solutions (CloudWatch, Datadog, Splunk)
- Retry Mechanisms (Conceptual Example): Add retries to
OtpServicecalls to improve resilience against transient network issues.
const logger = new Logger('RetryLogic');
async function callWithRetry<T>(action: () => Promise<T>, maxAttempts: number, logger: Logger): Promise<T> {
let attempts = 0;
while (attempts < maxAttempts) {
attempts++;
try {
return await action();
} catch (error) {
logger.error(`Attempt ${attempts} failed: ${error.message}`, error.stack);
if (isTransientError(error) && attempts < maxAttempts) {
const delay = 1000 * Math.pow(2, attempts - 1);
logger.warn(`Retrying after ${delay}msβ¦`);
await new Promise(resolve => setTimeout(resolve, delay));
continue;
} else {
throw error;
}
}
}
throw new InternalServerErrorException('Action failed after maximum retry attempts.');
}
function isTransientError(error: any): boolean {
logger.warn('`isTransientError` check is currently a placeholder and always returns false. Implement real transient error detection logic.');
return false;
}
Caveat: The isTransientError function is critical and provided as a non-working
placeholder. You must implement logic to correctly identify which errors (based on codes,
status, or types) should trigger a retry. Retrying on user errors (like invalid number) is incorrect. The
usage example within sendOtp is commented out to avoid making the code block non-functional due
to the placeholder isTransientError and context assumptions. Circuit Breaker
Pattern: Protect your application from cascading failures when MessageBird is down. Use the circuit
breaker pattern (libraries like opossum or nestjs-circuit-breaker) to temporarily
stop sending requests to a failing service and provide fallback responses.
7. (Optional) Creating a Database Schema and Data Layer (Prisma Example)
This section is optional and only relevant if you need to store user data or link verified numbers.
- Initialize Prisma: If not done in Section 1, install Prisma dependencies and initialize:
npx prisma init --datasource-provider postgresql
Ensure your .env has the correct DATABASE_URL.
- Create User and Verification Schema:
Prisma
// prisma/schema.prisma
model User {
id String @id @default(cuid())
phoneNumber String @unique
isVerified Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
verifications Verification[]
}
model Verification {
id String @id @default(cuid())
userId String?
user User? @relation(fields: [userId], references: [id])
phoneNumber String
verificationId String @unique
status String // 'pending', 'verified', 'failed', 'expired'
attempts Int @default(0)
createdAt DateTime @default(now())
expiresAt DateTime
verifiedAt DateTime?
}
- Run Migrations:
npx prisma migrate dev --name init
npx prisma generate
- Integration Example: Track verification attempts for audit trails, implement cooldown periods between OTP requests, and link verified phone numbers to user accounts:
await this.prisma.verification.update({
where: { verificationId: id },
data: {
status: 'verified',
verifiedAt: new Date(),
},
});
await this.prisma.user.update({
where: { phoneNumber },
data: { isVerified: true },
});
Source Citations:
- Node.js LTS versions: https://nodejs.org/en/about/previous-releases (verified January 2025)
- NestJS version compatibility: NestJS v10+ requires Node.js v16+, v11.1.6 latest (https://github.com/nestjs/nest/releases)
- MessageBird Node.js SDK: v4.0.1 on npm (https://www.npmjs.com/package/messagebird)
- MessageBird Verify API documentation: https://developers.messagebird.com/api/verify/
Simpler Alternative: Send the Same SMS With SMSRoute (No-KYC, Direct Routes)
If you want to replace legacy aggregator SDK boilerplate, multi-week compliance queues, and opaque carrier surcharges with a single HTTP request, SMSRoute delivers global SMS over direct Tier-1 carrier interconnects with instant API access and transparent per-country pricing.
curl -X POST https://api.sendsmsnokyc.com/messages \
-H "x-api-key: $SMSROUTE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": ["+14155551234"],
"channel": ["sms"],
"body": "Your verification code is 482910"
}'
- Instant onboarding: No KYC paperwork or sales queues β grab an API key and fund with crypto (BTC/USDT) or card.
- Direct Tier-1 routes: Verify real handset delivery, DLR latency, and Sender ID preservation before launch via SMSRoute Live Carrier Testing.
- Transparent global pricing: Compare exact per-country termination rates on our live pricing page.
Ship Global SMS in One API Call
Skip legacy SDK sprawl and carrier bottlenecks. Send OTPs, alerts, and bulk campaigns across 190+ countries with SMSRoute.
Explore SMSRoute Developers β