Tutorials

MessageBird WhatsApp API Integration with Next.js and Node.js (2026 Guide)

Complete tutorial: Integrate MessageBird WhatsApp Business API with Next.js 15 and Node.js. Learn to send messages, receive webhooks, handle templates, and build production-ready WhatsApp messaging apps.

JH
Jacky Hossein
β€’ Principal Telecommunications Architect β€’ Published Nov 5, 2026 β€’ 16 min read

Developer Quick-Start: Complete tutorial: Integrate MessageBird WhatsApp Business API with Next.js 15 and Node.js. Learn to send messages, receive webhooks, handle templates, and build production-ready WhatsApp messaging apps. 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.

This comprehensive guide shows you how to integrate the MessageBird WhatsApp Business API into a Next.js application. You'll build a production-ready system that sends and receives WhatsApp messages, leveraging Next.js API routes, Node.js runtime, and MessageBird's WhatsApp Business platform.

This integration enables businesses to engage customers directly on WhatsApp for customer support, notifications, alerts, two-factor authentication, and automated messaging – all managed through a modern, scalable Next.js application. Whether you're building a customer service platform, notification system, or marketing automation tool, this guide provides the foundation for WhatsApp Business API integration.

Important: MessageBird rebranded to Bird in February 2024, though the API endpoints, SDK (messagebird npm package), and functionality remain unchanged. This guide uses the original MessageBird SDK and terminology interchangeably with Bird.

Project Overview and Goals

What You'll Build:

A Next.js application with the following capabilities:

  1. API endpoint to send outbound WhatsApp messages (text and pre-approved templates) via MessageBird.
  2. API endpoint configured as a MessageBird webhook to receive inbound WhatsApp messages.
  3. Secure handling of API credentials and webhook secrets.
  4. Basic logging and error handling for message operations.
  5. (Optional) Basic database integration to log message history.

Problem Solved:

This guide helps you programmatically interact with customers on WhatsApp using MessageBird, integrated within Next.js. It simplifies the process compared to managing the complexities of the direct WhatsApp Business API infrastructure.

Technologies Used:

  • Next.js: A React framework for building full-stack web applications, providing server-side rendering, static site generation, and API routes for building RESTful endpoints.
  • Node.js: The JavaScript runtime environment used by Next.js for backend operations.
  • MessageBird: A communication platform as a service (CPaaS) providing APIs for various channels, including WhatsApp. You'll use their Node.js SDK.
  • dotenv: For managing environment variables securely.
  • (Optional) Prisma: A modern database toolkit for Node.js and TypeScript, used here for optional message logging.
  • (Optional) PostgreSQL/SQLite: Relational databases for storing message logs.

System Architecture:

+-----------------+      +---------------------+      +-----------------+      +----------+
| User/Client App |----->| Next.js Application |----->| MessageBird API |----->| WhatsApp |
| (Browser/API)   |      | (API Routes)        |<-----| (Webhooks)      |<-----|          |
+-----------------+      +---------------------+      +-----------------+      +----------+
                         |                     |
                         | (Optional)          |
                         | +-----------------+ |
                         | | Database        | |
                         | | (Prisma)        | |
                         | +-----------------+ |
                         +---------------------+

Prerequisites:

  • Node.js (v20 LTS or v22 LTS recommended for 2025; Next.js 15 requires minimum v18.18.0, but v18 was deprecated in Next.js 15.4) and npm/yarn installed.
  • A MessageBird account with access to the WhatsApp Business API.
  • A WhatsApp Business channel configured in your MessageBird dashboard (follow their onboarding quickstart).
  • A registered and approved WhatsApp number linked to your MessageBird channel (must be E.164 format: +[country code][number], up to 15 digits).
  • Basic understanding of Next.js, React, and API concepts.
  • (Optional) Docker and Docker Compose for containerized database setup.
  • (Optional) ngrok or alternatives like Pinggy, Cloudflare Tunnel, or Tunnelmole for testing webhooks locally. Free ngrok URLs are temporary and change each restart, requiring webhook URL updates in MessageBird; consider Pinggy (unlimited bandwidth, $3/month) or Cloudflare Tunnel (free, no bandwidth limits) for persistent URLs during development.

Expected Outcome:

A functional Next.js application that sends text and template messages via MessageBird's WhatsApp API and receives incoming messages through a configured webhook. This guide provides a functional starting point. While it includes patterns for production (security checks, logging suggestions), the core code examples use basic constructs (like console.log) and include placeholders (// TODO:) requiring further implementation for a truly production-ready system.


1. Set Up Your Next.js Project for MessageBird WhatsApp Integration

Initialize your Next.js project and install the necessary dependencies for WhatsApp Business API integration.

1.1 Create Next.js App:

Open your terminal and run:

npx create-next-app@latest messagebird-whatsapp-nextjs --typescript --eslint --tailwind --src-dir --app --import-alias "@/*"
cd messagebird-whatsapp-nextjs

(Adjust flags like --typescript, --tailwind based on your preferences. This guide assumes TypeScript and the src/ directory structure).

1.2 Install Dependencies:

Install the MessageBird Node.js SDK and dotenv for environment variables. If using Prisma, install it as well.

npm install messagebird dotenv

npm install prisma @prisma/client

npx prisma init --datasource-provider postgresql

1.3 Configure Environment Variables:

Create a file named .env.local in your project root. This file stores sensitive credentials and configuration. Never commit this file to version control.

.env

# .env.local

# MessageBird Credentials (Get from MessageBird Dashboard -> Developers -> API Access)
MESSAGEBIRD_API_KEY="YOUR_LIVE_OR_TEST_API_KEY"

# MessageBird WhatsApp Channel ID (Get from MessageBird Dashboard -> Channels -> WhatsApp -> Your Channel)
MESSAGEBIRD_CHANNEL_ID="YOUR_WHATSAPP_CHANNEL_ID"

# MessageBird Webhook Signing Secret (Generate/Get from Webhook settings in MessageBird Dashboard)
MESSAGEBIRD_WEBHOOK_SECRET="YOUR_WEBHOOK_SIGNING_SECRET"

# (Optional) Database URL for Prisma
# Example for PostgreSQL using Docker Compose (see section 6)
DATABASE_URL="postgresql://user:password@localhost:5432/mydb?schema=public"
# Example for SQLite
# DATABASE_URL="file:./dev.db"

# Base URL for your deployed application (needed for setting the webhook)
# For local development with ngrok, this might be like: https://xxxxx.ngrok-free.app
# For production, it will be your domain: https://yourapp.com
NEXT_PUBLIC_APP_URL="http://localhost:3000" # Default, update as needed

Explanation:

  • MESSAGEBIRD\_API\_KEY: Authenticates your application with the MessageBird API. Use your Live key for production. Caution: Never commit your .env.local file containing live keys to version control. Use Test keys during development when possible.
  • MESSAGEBIRD\_CHANNEL\_ID: Identifies the specific WhatsApp channel you configured in MessageBird (a long alphanumeric string found in Dashboard > Channels > WhatsApp).
  • MESSAGEBIRD\_WEBHOOK\_SECRET: Verifies that incoming webhook requests genuinely originate from MessageBird. MessageBird signs requests using HMAC-SHA256 with this secret, sent via the MessageBird-Signature-JWT header.
  • DATABASE\_URL: Connection string for Prisma if you're implementing database logging.
  • NEXT\_PUBLIC\_APP\_URL: The publicly accessible base URL of your application, used when configuring the webhook URL in the MessageBird dashboard.

1.4 Project Structure:

Your relevant project structure should look similar to this:

messagebird-whatsapp-nextjs/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/                    # API Routes
β”‚   β”‚   β”‚   β”œβ”€β”€ send-whatsapp/      # Endpoint for sending messages
β”‚   β”‚   β”‚   β”‚   └── route.ts
β”‚   β”‚   β”‚   β”œβ”€β”€ messagebird-webhook/ # Endpoint for receiving messages
β”‚   β”‚   β”‚   β”‚   └── route.ts
β”‚   β”‚   β”‚   └── health/             # Basic health check
β”‚   β”‚   β”‚       └── route.ts
β”‚   β”‚   β”œβ”€β”€ page.tsx                # Example frontend page (optional)
β”‚   β”‚   └── layout.tsx
β”‚   β”œβ”€β”€ lib/                        # Utility functions/SDK initialization
β”‚   β”‚   β”œβ”€β”€ messagebird.ts
β”‚   β”‚   └── prisma.ts              # (Optional) Prisma client instance
β”‚   └── ... (other Next.js files)
β”œβ”€β”€ prisma/                         # (Optional) Prisma schema and migrations
β”‚   └── schema.prisma
β”œβ”€β”€ .env.local                      # Environment variables (DO NOT COMMIT)
β”œβ”€β”€ next.config.mjs
β”œβ”€β”€ package.json
└── tsconfig.json

1.5 Initialize MessageBird SDK:

Create a utility file to initialize the MessageBird client.

import messagebird from 'messagebird';

if (!process.env.MESSAGEBIRD_API_KEY) {
  throw new Error("Missing MESSAGEBIRD_API_KEY environment variable");
}

const mbClient = messagebird(process.env.MESSAGEBIRD_API_KEY);

export default mbClient;

This initializes the SDK using the API key from your environment variables, making it ready to use in your API routes.


2. How to Send WhatsApp Messages Using MessageBird API

Create the Next.js API route responsible for sending outbound WhatsApp messages through MessageBird. This endpoint handles both text messages and pre-approved WhatsApp templates for business-initiated conversations.

2.1 Create the API Route:

Create the file src/app/api/send-whatsapp/route.ts.

import { NextRequest, NextResponse } from 'next/server';
import mbClient from '@/lib/messagebird';
import { MessageBird } from 'messagebird/types';

interface SendMessageRequestBody {
  to: string;
  text?: string;
  template?: {
    name: string;
    language: string;
    components?: MessageBird.MessageRequestTemplate['components'];
  };
}

export async function POST(request: NextRequest) {
  console.log("Received request to /api/send-whatsapp");

  let body: SendMessageRequestBody;
  try {
    body = await request.json();
    console.log("Request body:", body);


    if (!body.to || (!body.text && !body.template)) {
      console.error("Validation failed: Missing 'to' or message content ('text'/'template')");
      return NextResponse.json({ error: "Missing 'to' or message content ('text'/'template')" }, { status: 400 });
    }
    if (!process.env.MESSAGEBIRD_CHANNEL_ID) {
        console.error("Configuration error: Missing MESSAGEBIRD_CHANNEL_ID");
        return NextResponse.json({ error: "Server configuration error: Channel ID missing" }, { status: 500 });
    }

  } catch (error) {
    console.error("Failed to parse request body:", error);
    return NextResponse.json({ error: 'Invalid request body' }, { status: 400 });
  }

  const params: MessageBird.MessageRequest = {
    to: body.to,
    from: process.env.MESSAGEBIRD_CHANNEL_ID,
    type: 'text',
    content: {},
  };


  if (body.template) {
    params.type = 'hsm';
    params.content = {
      hsm: {



        namespace: 'your_messagebird_template_namespace',
        templateName: body.template.name,
        language: {
          policy: 'deterministic',
          code: body.template.language,
        },
        components: body.template.components || [],
      },
    };
    console.log("Sending template message:", params);
  } else if (body.text) {
    params.type = 'text';
    params.content = { text: body.text };
    console.log("Sending text message:", params);
  } else {

      console.error("No message content provided.");
      return NextResponse.json({ error: "No message content provided" }, { status: 400 });
  }

  try {

    const result = await new Promise<MessageBird.Message>((resolve, reject) => {
      mbClient.messages.create(params, (err, response) => {
        if (err) {
          console.error("MessageBird API Error:", err);

          const errorDetails = err.errors ? JSON.stringify(err.errors) : err.message;
          reject(new Error(`MessageBird API Error: ${errorDetails}`));
        } else if (response) {
          console.log("MessageBird API Success:", response);
          resolve(response);
        } else {
          reject(new Error("MessageBird API returned undefined response"));
        }
      });
    });

    return NextResponse.json({ success: true, messageId: result.id, status: result.status }, { status: 201 });

  } catch (error: any) {
    console.error("Error sending message:", error);

    return NextResponse.json({ success: false, error: 'Failed to send message', details: error.message }, { status: 500 });
  }
}

export async function GET() {
  return NextResponse.json({ message: "POST to this endpoint to send a WhatsApp message." });
}

Explanation:

  1. Import Dependencies: Import NextRequest, NextResponse, the initialized mbClient, and MessageBird types.
  2. Define Request Body: An interface SendMessageRequestBody defines the expected structure of incoming POST requests. Use a validation library like Zod for production.
  3. POST Handler: This asynchronous function handles POST requests.
  4. Parse & Validate: Parse the JSON body and perform basic validation to ensure the recipient (to) and message content (text or template) are present. Check for the MESSAGEBIRD\_CHANNEL\_ID.
  5. Construct Parameters: Build the params object required by the messagebird.messages.create method.
  • to: Recipient number.
  • from: Your MessageBird WhatsApp Channel ID (from .env.local).
  • type: Set to 'text' or 'hsm' (for templates).
  • content: An object containing either { text: "…" } or { hsm: { … } }.
  1. Template Handling: If body.template exists, set type to hsm and construct the hsm object.
  • namespace: Crucial: Find your template namespace in the MessageBird dashboard (usually associated with your Facebook Business Manager or template details). Replace 'your\_messagebird\_template\_namespace' with this value.
  • templateName: The name of your pre-approved template.
  • language: The language code (e.g., en\_US).
  • components: An array to pass parameters (variables) for your template placeholders. The structure depends on your template (header, body, buttons). Refer to MessageBird's documentation for component structure.
  1. Text Handling: If body.text exists, set type to text and content accordingly.
  2. API Call: Use mbClient.messages.create to send the message. (Note: This example wraps the callback-based SDK method in a Promise for use with async/await. Check the documentation for the specific version of the messagebird SDK you're using; newer versions might offer direct Promise support.)
  3. Error Handling: A try…catch block handles potential errors during parsing, validation, or the API call itself. Specific MessageBird API errors are logged server-side.
  4. Response: Return a JSON response indicating success (with message ID) or failure.
  5. Logging: Uses console.log/console.error for simplicity in this example. For production, replace with a structured logger (see Section 5.2).

3. How to Receive WhatsApp Messages Using MessageBird Webhooks

Create the webhook endpoint that MessageBird calls whenever your WhatsApp Business number receives an inbound message or delivery status update. This enables real-time two-way messaging capabilities in your Next.js application.

3.1 Create the Webhook API Route:

Create the file src/app/api/messagebird-webhook/route.ts.

import { NextRequest, NextResponse } from 'next/server';
import crypto from 'crypto';
import { MessageBird } from 'messagebird/types';

async function verifySignature(request: NextRequest): Promise<boolean> {

  const signature = request.headers.get('messagebird-signature');
  const timestamp = request.headers.get('messagebird-request-timestamp');
  const webhookSecret = process.env.MESSAGEBIRD_WEBHOOK_SECRET;

  if (!signature || !timestamp || !webhookSecret) {
    console.warn('Webhook verification failed: Missing signature, timestamp, or secret');
    return false;
  }


  const requestClone = request.clone();
  const bodyText = await requestClone.text();


  const signedPayload = `${timestamp}.${webhookSecret}.${bodyText}`;


  const expectedSignature = crypto
    .createHmac('sha256', webhookSecret)
    .update(signedPayload)
    .digest('hex');


  const isValid = crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expectedSignature));

  if (!isValid) {
      console.warn('Webhook verification failed: Invalid signature');
      console.log(`Received Signature: ${signature}`);
      console.log(`Expected Signature: ${expectedSignature}`);


  }

  return isValid;
}

export async function POST(request: NextRequest) {
  console.log("Received POST request to /api/messagebird-webhook");


  const isVerified = await verifySignature(request);
  if (!isVerified) {
    console.error("Webhook signature verification failed.");
    return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
  }
  console.log("Webhook signature verified successfully.");


  let payload: MessageBird.WebhookPayload;
  try {
    payload = await request.json();
    console.log('Received webhook payload:', JSON.stringify(payload, null, 2));
  } catch (error) {
    console.error('Failed to parse webhook payload:', error);
    return NextResponse.json({ error: 'Invalid payload' }, { status: 400 });
  }


  try {
    switch (payload.type) {
      case 'message.created':
      case 'message.updated':
        const messageEvent = payload as MessageBird.MessageEvent;
        console.log(`Processing ${payload.type} event for message ID: ${messageEvent.message.id}`);
        console.log(`Direction: ${messageEvent.message.direction}, Status: ${messageEvent.message.status}`);


        if (messageEvent.message.direction === 'mo') {
          console.log(`Received message from ${messageEvent.message.originator}:`);
          console.log(`Type: ${messageEvent.message.content.type}, Content:`, messageEvent.message.content);








        } else if (messageEvent.message.direction === 'mt') {
            console.log(`Status update for outgoing message ${messageEvent.message.id}: ${messageEvent.message.status}`);



        }
        break;






      default:
        console.log(`Received unhandled event type: ${payload.type}`);
    }



    return NextResponse.json({ success: true }, { status: 200 });

  } catch (processingError) {
    console.error('Error processing webhook payload:', processingError);



    return NextResponse.json({ success: false, error: 'Failed to process webhook' }, { status: 500 });
  }
}

export async function GET() {
  console.log("Received GET request to /api/messagebird-webhook");

  return NextResponse.json({ message: "MessageBird Webhook endpoint is active. Use POST for events." });
}

Explanation:

  1. Import Dependencies: Includes crypto for signature verification and optional prisma.
  2. verifySignature Function:
  • Retrieves the messagebird-signature, messagebird-request-timestamp headers, and your MESSAGEBIRD\_WEBHOOK\_SECRET.
  • Reads the raw request body without parsing it as JSON first. Cloning the request is essential as the body stream can only be read once.
  • Constructs the signedPayload string exactly as MessageBird requires: timestamp.webhookSecret.rawBody.
  • Calculates the expected HMAC SHA256 hash using your secret.
  • Uses crypto.timingSafeEqual for secure comparison to prevent timing attacks.
  • Returns true if signatures match, false otherwise. Logs warnings on failure.
  1. POST Handler:
  • Verify Signature: Call verifySignature immediately. If verification fails, return a 401 Unauthorized response and stop processing. This is critical for security.
  • Parse Payload: Only after verification succeeds, parse the JSON payload.
  • Process Event: Use a switch statement on payload.type to handle different events.
  • message.created / message.updated: Log details about the message, including direction (mo for incoming, mt for outgoing) and status.
  • Incoming Message Logic (mo): Extract sender (originator), content type, and content. Includes commented-out Prisma code for logging the message to a database. The // TODO: block is where you implement your specific business logic for responding to or acting upon received messages.
  • Outgoing Status Update Logic (mt): Log status updates for messages you sent. Includes commented-out Prisma code for updating the status in the database.
  • Acknowledge Receipt: Return a 200 OK response to MessageBird promptly. This signals that you've received the event. Delaying this response can cause MessageBird to retry sending the webhook.
  • Error Handling: Catch errors during payload processing and log them. Return 200 OK for non-critical processing errors to avoid webhook retries, but return 500 if the error prevents meaningful processing.
  • Logging: Uses console.log/console.error/console.warn for simplicity. For production, replace with a structured logger (see Section 5.2).

4. Configure MessageBird Dashboard for WhatsApp API Access

Connect your Next.js application to your MessageBird account by obtaining API credentials, configuring the WhatsApp channel, and setting up webhooks for message delivery.

4.1 Obtain API Key:

  • Navigate to your MessageBird Dashboard.
  • Go to Developers > API access.
  • Copy your Live API key (or Test API key for development).
  • Paste this value into your .env.local file for MESSAGEBIRD\_API\_KEY.

4.2 Obtain WhatsApp Channel ID:

  • In the MessageBird Dashboard, go to Channels.
  • Select your configured WhatsApp channel.
  • Find the Channel ID (usually a long alphanumeric string).
  • Paste this value into MESSAGEBIRD\_CHANNEL\_ID in your .env.local.

4.3 Configure Webhook:

  • In your WhatsApp Channel settings in the MessageBird Dashboard, find the Webhook or Events section.
  • You need to provide a publicly accessible URL for your webhook handler.
  • Production: Use your deployed application's URL: https://your-app-domain.com/api/messagebird-webhook
  • Local Development:
  1. Start your Next.js app: npm run dev
  2. Expose local server using a tunneling service:
  • ngrok (free, temporary URLs): ngrok http 3000 β†’ Use the https URL (e.g., https://a1b2-c3d4.ngrok-free.app/api/messagebird-webhook). URLs change on restart.
  • Pinggy (recommended for development): ssh -p 443 -R0:localhost:3000 a.pinggy.io β†’ Provides persistent URLs, unlimited bandwidth. Free tier available, paid plans start at $3/month.
  • Cloudflare Tunnel (free, persistent): Install cloudflared, run cloudflared tunnel --url http://localhost:3000 β†’ No bandwidth limits, stable URLs.
  • Tunnelmole (open-source): tmole 3000 β†’ Simple, fast, free for normal use.
  1. Use the tunnel URL in MessageBird: https://your-tunnel-url/api/messagebird-webhook
  • Paste the appropriate URL into the Webhook URL field in MessageBird.
  • Webhook Signing Secret:
  • MessageBird allows you to view or generate a Signing Key (or Secret) for your webhook.
  • Copy this secret value.
  • Paste it into MESSAGEBIRD\_WEBHOOK\_SECRET in your .env.local.
  • Select Events: Ensure you subscribe to relevant events, at least message.created and message.updated.
  • Save the webhook configuration in MessageBird.

4.4 Update NEXT_PUBLIC_APP_URL:

Ensure the NEXT_PUBLIC_APP_URL in your .env.local matches the base URL you used for the webhook (especially important if using ngrok or deploying).


5. Implement Error Handling and Logging for Production

Robust error handling and logging are essential for production WhatsApp Business API integrations. Proper logging helps you troubleshoot issues, track message delivery, and monitor system performance.

5.1 Error Handling Strategy:

  • API Routes: Use try…catch blocks extensively in both send-whatsapp and messagebird-webhook routes.
  • Validation: Implement input validation (e.g., using Zod) early in the request lifecycle to catch malformed requests.
  • Specific Errors: Catch specific errors from the MessageBird SDK and database operations. Log detailed error information server-side (stack trace, request context).
  • Client Responses: Return clear, concise error messages to the client for API calls (/api/send-whatsapp), but avoid exposing sensitive internal details. For webhooks (/api/messagebird-webhook), prioritize returning a 200 OK quickly unless there's a critical failure preventing processing.
  • Environment Checks: Check for the existence of necessary environment variables on startup or early in request handling.

5.2 Logging:

While console.log/console.error is used in this guide's examples for simplicity, replace it with a structured logging library for production (e.g., pino, winston).

  • Install Pino: npm install pino pino-pretty (pino-pretty for development).
  • Configure Logger: Create a logger instance (e.g., src/lib/logger.ts) and use it throughout your API routes.
import pino from 'pino';

const logger = pino({
  level: process.env.LOG_LEVEL || 'info',
  transport: process.env.NODE_ENV !== 'production'
    ? { target: 'pino-pretty' }
    : undefined,
});

export default logger;
  • Log Levels: Use appropriate levels (info, warn, error, debug).
  • Context: Include relevant context in logs (request ID, user ID if applicable, message ID).
  • Note: The code examples in Sections 2.1 and 3.1 use console.log for simplicity. For production applications, replace these with structured logging using a library like Pino, as demonstrated here.

Frequently Asked Questions (FAQ)

What Node.js version do I need for MessageBird WhatsApp integration with Next.js 15?

Use Node.js v20 LTS or v22 LTS for Next.js 15 in 2025. Next.js 15 requires minimum v18.18.0, but v18 was deprecated in Next.js 15.4. v20 and v22 provide long-term support and compatibility.

How do I format phone numbers for WhatsApp Business API?

WhatsApp requires E.164 format: +[country code][number], up to 15 digits total (e.g., +14155552671). Include the country code with no spaces or special characters. Landlines and mobile numbers work, but short codes and numbers from sanctioned countries (Crimea, Cuba, Iran, North Korea, Syria) are excluded.

What is the WABA template namespace in MessageBird?

The WABA (WhatsApp Business Account) template namespace is a unique identifier bundle for your business's message templates. Find it in MessageBird Dashboard > Templates > Template Details (format: cdb2df51_9816_c754_c5a4_64cdabdcad3e). This namespace is required for sending HSM (Highly Structured Message) template messages.

How does MessageBird webhook signature verification work?

MessageBird signs webhooks using HMAC-SHA256 with the MessageBird-Signature-JWT header. Your application must construct the signed payload as timestamp.secret.body, compute the HMAC-SHA256 hash using your webhook secret, and compare it with the received signature using crypto.timingSafeEqual() to prevent timing attacks.

What's the difference between MessageBird and Bird?

MessageBird rebranded to Bird in February 2024 with 90% price cuts on SMS. However, the API endpoints, Node.js SDK (messagebird npm package), and WhatsApp functionality remain unchanged. Existing integrations continue working without modification.

Which webhook tunneling tool is best for local WhatsApp development?

For persistent URLs during development, use Pinggy ($3/month, unlimited bandwidth) or Cloudflare Tunnel (free, no bandwidth limits). While ngrok works, free URLs are temporary and change on restart, requiring frequent webhook URL updates in MessageBird. Tunnelmole offers an open-source alternative.

Can I use Prisma with Next.js 15 for logging WhatsApp messages?

Yes, Prisma 6.7.0+ is fully compatible with Next.js 15.3.1+. Use Prisma to log incoming and outgoing WhatsApp messages, track delivery status, and maintain conversation history. The guide includes commented code examples for database integration.

How do I send WhatsApp template messages vs. regular text messages?

Regular text messages set type: 'text' with content: { text: "…" }. Template messages set type: 'hsm' with your approved template name, WABA namespace, language code, and component parameters. Templates are required for business-initiated conversations or re-engagement after 24 hours of inactivity.

What are the benefits of using MessageBird WhatsApp API with Next.js?

MessageBird WhatsApp API with Next.js provides serverless deployment capabilities, easy API route management, built-in TypeScript support, and seamless integration with modern React frameworks. You get automatic scaling, edge network distribution, and simplified webhook handling through Next.js API routes.

How do I troubleshoot WhatsApp message delivery failures?

Check MessageBird API error codes in your logs, verify E.164 phone number formatting, ensure your WhatsApp channel is active, confirm template approval status, and validate webhook signature verification. For SMS-related troubleshooting, similar principles apply to phone number formatting and API authentication.

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 β†’