Tutorials

Handling Sinch Conversation API Callbacks with NestJS

A guide on building a production-ready webhook handler using Node.js and NestJS to securely receive, validate, and process callbacks from the Sinch Conversation API.

JH
Jacky Hossein
β€’ Principal Telecommunications Architect β€’ Published Nov 7, 2026 β€’ 14 min read

Developer Quick-Start: A guide on building a production-ready webhook handler using Node.js and NestJS to securely receive, validate, and process callbacks from the Sinch Conversation API. 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.

Real-time updates are crucial for modern messaging applications. Knowing when a message is delivered, read, or when a user replies is essential for building responsive and reliable communication flows. Polling APIs for status updates is inefficient and slow. Sinch's Conversation API solves this by using webhooks to push near real-time notifications (callbacks) directly to your application.

This guide provides a step-by-step walkthrough for building a production-ready webhook handler using Node.js and the NestJS framework to securely receive, validate, and process callbacks from the Sinch Conversation API. We will focus on handling message delivery status updates (MESSAGE_DELIVERY) and inbound messages (MESSAGE_INBOUND).

By the end of this guide, you will have a robust NestJS application capable of:

  • Receiving HTTP POST requests from Sinch webhooks.
  • Securely validating incoming requests using HMAC signatures.
  • Parsing different Sinch callback event types.
  • Logging callback details for monitoring and debugging.
  • Responding correctly to Sinch to acknowledge receipt and prevent unnecessary retries.

Technologies Used:

  • Node.js: The JavaScript runtime environment.
  • NestJS: A progressive Node.js framework for building efficient, reliable, and scalable server-side applications using TypeScript. Its modular architecture and built-in features make it ideal for creating robust API endpoints.
  • Sinch Conversation API: The Sinch service providing messaging capabilities and webhook notifications.
  • ngrok (or alternative): A tool to expose your local development server to the internet, allowing Sinch to send callbacks to it during testing. Essential for the local testing workflow described here, but optional if you already have a publicly accessible development server.

System Architecture:

The basic flow is straightforward:

graph LR
    A[Sinch Platform] -- 1. Sends Message --> B(End User Channel e.g., SMS, WhatsApp);
    B -- 2. Sends Reply / Channel Confirms Delivery --> A;
    A -- 3. Triggers Webhook (HTTP POST) --> C{Your NestJS Application Endpoint};
    C -- 4. Validates HMAC Signature --> D[Process Callback Logic];
    D -- 5. Logs Event / Updates Database / etc. --> E(Monitoring/Datastore);
    C -- 6. Sends 200 OK Response --> A;

Prerequisites:

  • Node.js (LTS version recommended) and npm (or yarn) installed.
  • NestJS CLI installed (npm install -g @nestjs/cli).
  • A Sinch account with access to the Conversation API. You'll need your Project ID and an App ID.
  • Sinch API Credentials: To trigger test messages or configure webhooks via the API (shown later), you will need API credentials, typically a Service Plan ID and API Token, or an API Key and Secret, depending on your authentication method. These are used to obtain access tokens.
  • A publicly accessible HTTPS URL for your webhook endpoint. During local development, ngrok is highly recommended. If using the .env configuration below (PORT=3000), you would run: ngrok http 3000.
  • Basic understanding of TypeScript and REST APIs.

1. Setting up the NestJS project

Let's create a new NestJS project and configure it to handle Sinch callbacks.

1. Create a new NestJS project:

Open your terminal and run the NestJS CLI command:

nest new sinch-callback-handler

cd sinch-callback-handler

This command scaffolds a new project with the necessary base structure.

2. Install Dependencies:

We need the @nestjs/config module to manage environment variables securely.

npm install @nestjs/config

3. Configure Environment Variables:

Sensitive information like API keys or webhook secrets should never be hardcoded. We'll use environment variables.

Create a .env file in the project root:

.env

# .env

# Port the NestJS application will run on
PORT=3000

# The secret key configured for your Sinch webhook (generate a strong one)
SINCH_WEBHOOK_SECRET=your_strong_sinch_webhook_secret_here
  • PORT: Specifies the port your local server will listen on (used for ngrok http 3000).
  • SINCH\_WEBHOOK\_SECRET: This must match the secret you configure in the Sinch portal for your webhook. It's used for HMAC signature validation.

Create a .env.example file to document required variables (useful for collaborators):

.env

# .env.example

PORT=
SINCH_WEBHOOK_SECRET=

Ensure .env is added to your .gitignore file to prevent accidentally committing secrets:

# .gitignore (ensure this line exists or add it)
.env

4. Enable Raw Body Parsing:

Sinch's HMAC signature validation requires access to the raw, unparsed request body. NestJS needs to be configured to make this raw body available.

Modify src/main.ts to enable the rawBody option in the NestFactory.create call.

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

import { ConfigService } from '@nestjs/config';
import { Logger, ValidationPipe } from '@nestjs/common';

async function bootstrap() {
  const app = await NestFactory.create(AppModule, {


    rawBody: true,
  });

  const configService = app.get(ConfigService);
  const port = configService.get<number>('PORT', 3000);


  app.useGlobalPipes(new ValidationPipe());





  await app.listen(port);
  Logger.log(`Application listening on port ${port}`, 'Bootstrap');
}
bootstrap();

Explanation:

  • rawBody: true in NestFactory.create tells NestJS's underlying adapter (usually Express) to keep the original raw buffer accessible via req.rawBody on the Request object, which is essential for HMAC validation.
  • We fetch the PORT using the ConfigService.
  • We use the NestJS Logger for better-structured logging.

5. Load Configuration Module:

Import and register the ConfigModule in your main application module (src/app.module.ts) to make environment variables accessible throughout the application via the ConfigService.

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { ConfigModule } from '@nestjs/config';
import { WebhookModule } from './webhook/webhook.module';

@Module({
  imports: [
    ConfigModule.forRoot({
      isGlobal: true,
      envFilePath: '.env',
    }),
    WebhookModule,
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}
  • ConfigModule.forRoot({...}): Initializes the configuration module.
  • isGlobal: true: Allows injecting ConfigService anywhere without importing ConfigModule in feature modules.
  • envFilePath: '.env': Tells the module where to find the environment variables file.

Our basic project structure and configuration are now ready.

2. Implementing the webhook handler

Now, let's create the module, controller, and service responsible for handling incoming Sinch callbacks.

1. Generate the Webhook Module, Controller, and Service:

Use the NestJS CLI to generate these components:

nest g module webhook
nest g controller webhook --flat --no-spec
nest g service webhook --flat --no-spec

This creates:

  • src/webhook/webhook.module.ts
  • src/webhook/webhook.controller.ts
  • src/webhook/webhook.service.ts

Remember to import WebhookModule into AppModule as shown in the previous step.

2. Implement the Webhook Controller:

The controller defines the route (/webhook in this case) and handles the incoming HTTP request. It extracts necessary information (headers, raw body) and passes it to the service for validation and processing.

import {
  Controller,
  Post,
  Req,
  Res,
  Headers,
  Logger,
  HttpCode,
  HttpStatus,
  RawBodyRequest,
} from '@nestjs/common';
import { Request, Response } from 'express';
import { WebhookService } from './webhook.service';

@Controller('webhook')
export class WebhookController {
  private readonly logger = new Logger(WebhookController.name);

  constructor(private readonly webhookService: WebhookService) {}

  @Post()
  @HttpCode(HttpStatus.OK)
  async handleWebhook(
    @Headers() headers: Record<string, string>,
    @Req() req: RawBodyRequest<Request>,
    @Res() res: Response,
  ): Promise<void> {
    this.logger.log('Received webhook request');


    const rawBody = req.rawBody;
    if (!rawBody) {
      this.logger.error('Raw body missing from request.');

      res.status(HttpStatus.BAD_REQUEST).send('Raw body is required.');
      return;
    }


    const isValid = this.webhookService.validateSignature(headers, rawBody);

    if (!isValid) {
      this.logger.warn('Invalid webhook signature received.');

      res.status(HttpStatus.FORBIDDEN).send('Invalid signature.');
      return;
    }

    this.logger.log('Webhook signature validated successfully.');

    try {

      const payload = JSON.parse(rawBody.toString('utf-8'));



      this.webhookService.processCallback(payload).catch((error) => {

        this.logger.error(
          `Error processing webhook payload: ${error.message}`,
          error.stack,
        );
      });



      res.status(HttpStatus.OK).send('Webhook received successfully.');
    } catch (error) {
      this.logger.error(
        `Error parsing webhook JSON payload: ${error.message}`,
        rawBody.toString('utf-8'),
      );

      res
        .status(HttpStatus.BAD_REQUEST)
        .send('Invalid JSON payload received.');
    }
  }
}

Explanation:

  • @Controller('webhook'): Defines the base route /webhook.
  • @Post(): Decorator for the HTTP POST method handler.
  • @HttpCode(HttpStatus.OK): Sets the default success status code to 200 OK.
  • @Headers() headers: Injects all request headers.
  • @Req() req: RawBodyRequest<Request>: Injects the Express request object, typed with RawBodyRequest to indicate req.rawBody is available thanks to the rawBody: true option used in main.ts.
  • @Res() res: Response: Injects the Express response object, allowing us to send custom status codes and bodies.
  • Raw Body Access: We access req.rawBody, which contains the raw request payload as a Buffer.
  • Validation: Calls webhookService.validateSignature() with headers and the raw body.
  • Error Handling: Sends 400 Bad Request if raw body is missing or JSON parsing fails, and 403 Forbidden if the signature is invalid.
  • Asynchronous Processing: Calls webhookService.processCallback() without await. This allows the controller to send the 200 OK response back to Sinch immediately after validation, acknowledging receipt. Actual processing happens in the background. Errors during processing are logged but don't prevent the acknowledgment.
  • Immediate Response: Sending res.status(HttpStatus.OK).send(...) is critical. Sinch expects a 2xx response quickly; otherwise, it assumes the delivery failed and will retry according to its policy.

3. Implement the Webhook Service:

The service contains the core logic for validating the signature and processing the callback payload.

import { Injectable, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import * as crypto from 'crypto';

@Injectable()
export class WebhookService {
  private readonly logger = new Logger(WebhookService.name);
  private readonly sinchWebhookSecret: string;

  constructor(private readonly configService: ConfigService) {
    this.sinchWebhookSecret = this.configService.get<string>(
      'SINCH_WEBHOOK_SECRET',
    );
    if (!this.sinchWebhookSecret) {
      this.logger.error(
        'SINCH_WEBHOOK_SECRET is not configured in environment variables.',
      );


    }
  }


  validateSignature(headers: Record<string, string>, rawBody: Buffer): boolean {
    if (!this.sinchWebhookSecret) {
      this.logger.error(
        'Cannot validate signature: SINCH_WEBHOOK_SECRET is not set.',
      );
      return false;
    }

    const timestamp = headers['x-sinch-webhook-signature-timestamp'];
    const nonce = headers['x-sinch-webhook-signature-nonce'];
    const algorithm = headers['x-sinch-webhook-signature-algorithm'];
    const receivedSignature = headers['x-sinch-webhook-signature'];

    if (!timestamp || !nonce || !algorithm || !receivedSignature) {
      this.logger.warn(
        'Missing required signature headers for validation.',
        { timestamp, nonce, algorithm, hasSignature: !!receivedSignature },
      );
      return false;
    }

    if (algorithm !== 'HmacSHA256') {
      this.logger.warn(`Unsupported signature algorithm: ${algorithm}`);
      return false;
    }

    try {


      const signedData = rawBody.toString('utf-8') + '.' + nonce + '.' + timestamp;


      const hmac = crypto.createHmac('sha256', this.sinchWebhookSecret);
      const expectedSignatureBuffer = hmac.update(signedData).digest();
      const expectedSignatureBase64 = expectedSignatureBuffer.toString('base64');


      const receivedSignatureBuffer = Buffer.from(receivedSignature, 'base64');


      if (expectedSignatureBuffer.length !== receivedSignatureBuffer.length) {
         this.logger.warn(`Signature length mismatch.`);
         return false;
      }

      const isValid = crypto.timingSafeEqual(
        expectedSignatureBuffer,
        receivedSignatureBuffer,
      );

      if (!isValid) {
        this.logger.warn(
            `Signature mismatch. Received: ${receivedSignature}, Expected: ${expectedSignatureBase64}`,
        );
      }

      return isValid;

    } catch (error) {
      this.logger.error(
        `Error during signature validation: ${error.message}`,
        error.stack,
      );
      return false;
    }
  }


  async processCallback(payload: any): Promise<void> {
    this.logger.log(
      `Processing validated callback for App ID: ${payload.app_id}`,
    );






    if (payload.message_delivery_report) {
      this.handleMessageDeliveryReport(payload);
    } else if (payload.message) {



      this.handleInboundMessage(payload);
    } else if (payload.event) {



      this.handleInboundEvent(payload);
    } else if (payload.contact_create_notification) {
      this.handleContactCreate(payload);
    }
      else {
      this.logger.warn(
        `Received unknown or unhandled callback type. Keys: ${Object.keys(payload).join(', ')}`,
      );
    }


  }



  private handleMessageDeliveryReport(payload: any): void {
    const report = payload.message_delivery_report;
    this.logger.log(
      `Handling Message Delivery Report: Msg ID [${report.message_id}], Status [${report.status}], Conv ID [${report.conversation_id}]`,
    );


  }

  private handleInboundMessage(payload: any): void {

    const message = payload.message;
    const contactMsg = message.contact_message;
    let textContent = '[Non-Text Message]';

    if (contactMsg.text_message) {
      textContent = contactMsg.text_message.text;
    } else if (contactMsg.media_message) {
      textContent = `[Media: ${contactMsg.media_message.url}]`;
    } else if (contactMsg.choice_response_message) {
        textContent = `[Choice Response: ${contactMsg.choice_response_message.postback_data}]`;
    } else if (contactMsg.location_message) {
        textContent = `[Location: ${contactMsg.location_message.title} (${contactMsg.location_message.coordinates.latitude}, ${contactMsg.location_message.coordinates.longitude})]`;
    }

    this.logger.log(
      `Handling Inbound Message: Msg ID [${message.id}], Contact [${message.contact_id}], Conv ID [${message.conversation_id}], Text: ""${textContent}""`,
    );


  }

  private handleInboundEvent(payload: any): void {

    const event = payload.event;
     if (event?.contact_event?.composing_event) {
        const state = event.contact_event.composing_event.action === 'START_COMPOSING' ? 'Start' : 'Stop';
        this.logger.log(`Handling Inbound Event: Composing ${state} - Contact [${payload.contact_id}], Conv ID [${payload.conversation_id}]`);
     } else if (event?.contact_event?.generic_event) {
         this.logger.log(`Handling Inbound Event: Generic Event - Contact [${payload.contact_id}], Type [${event.contact_event.generic_event.type}]`);
     } else if (event?.contact_message_event?.read_receipt_event) {
         const receiptType = event.contact_message_event.read_receipt_event.receipt_type;
         const messageId = event.contact_message_event.read_receipt_event.message_id;
         this.logger.log(`Handling Inbound Event: Read Receipt - Contact [${payload.contact_id}], Type [${receiptType}], Msg ID [${messageId}]`);
     }

     else {
        this.logger.log(`Handling Inbound Event: Unknown Type - Contact [${payload.contact_id}], Conv ID [${payload.conversation_id}]`);
     }

  }

   private handleContactCreate(payload: any): void {
        const contact = payload.contact_create_notification.contact;
        this.logger.log(`Handling Contact Create: Contact ID [${contact.id}], Display Name [${contact.display_name || 'N/A'}]`);

    }


}

Explanation:

  • Constructor: Injects ConfigService and retrieves the SINCH\_WEBHOOK\_SECRET from environment variables. It includes a crucial check to ensure the secret is set.
  • Type Safety Note: A comment is added reminding the developer to replace any with specific TypeScript interfaces for better code quality.
  • validateSignature:
  • Retrieves necessary headers (x-sinch-webhook-signature-\*).
  • Checks for missing headers or unsupported algorithms.
  • Constructs the signedData string: rawBodyString.nonce.timestamp. A critical note is added here emphasizing the need to verify this exact format against official Sinch documentation.
  • Calculates the expected HMAC-SHA256 signature using the sinchWebhookSecret.
  • Compares the calculated signature (Base64 encoded) with the received signature (x-sinch-webhook-signature) using crypto.timingSafeEqual to prevent timing attacks. This is a critical security measure.
  • Logs warnings or errors for debugging validation issues.
  • processCallback:
  • Logs the reception of a validated callback.
  • Uses a simple if/else if structure based on the presence of key fields in the payload (message\_delivery\_report, message, event, contact\_create\_notification, etc.) to determine the callback type. This aligns with the structure described in the Sinch documentation. Comments are added to clarify potential overlaps or alternative keys (like message\_redaction) depending on the specific trigger used.
  • Calls specific private handler methods for each relevant event type (e.g., handleMessageDeliveryReport, handleInboundMessage).
  • Includes a warning for unhandled callback types.
  • Specific Handlers: Placeholder methods (handleMessageDeliveryReport, etc.) demonstrate how to extract relevant information for different event types and log it. Comments within these handlers are now more specific, listing examples of message types (media, choice, location) or event types (composing, read receipts) that might need handling. This is where you would add your application-specific logic – updating databases, sending notifications, triggering workflows, etc.

3. Configuring the Sinch Webhook

Your NestJS application is ready to receive callbacks, but you need to tell Sinch where to send them and what events to send.

1. Get Your Public Webhook URL:

  • Local Development: Start your NestJS application (npm run start:dev or yarn start:dev). Then, use ngrok to expose your local port (e.g., 3000 as defined in .env) to the internet:
  ngrok http 3000

ngrok will provide a public HTTPS URL (e.g., https://<random\_string>.ngrok-free.app). Copy this HTTPS URL. Your webhook endpoint will be this URL + /webhook (e.g., https://<random\_string>.ngrok-free.app/webhook).

  • Production/Staging: Use the actual public HTTPS URL where your NestJS application is deployed (e.g., https://yourapi.yourdomain.com/webhook).

2. Configure Webhook in Sinch Portal:

  • Log in to your Sinch account dashboard.
  • Navigate to Conversation -> Apps.
  • Select the App you are using for sending/receiving messages.
  • Go to the Webhooks section within the App settings.
  • Click Add Webhook or edit an existing one.
  • Fill in the details:
  • Target: Paste your public HTTPS webhook URL (including the /webhook path) obtained in the previous step.
  • Target Type: Select HTTP.
  • Secret: Enter the exact same secret you defined in your .env file (SINCH\_WEBHOOK\_SECRET). This is crucial for HMAC validation. You can generate a strong random string for this.
  • Triggers: Select the events you want Sinch to send to this webhook. For this guide, select at least:
  • MESSAGE\_DELIVERY (for delivery receipts)
  • MESSAGE\_INBOUND (for messages sent by users to your app)
  • You can select others like EVENT\_INBOUND (composing, read receipts), CONTACT\_CREATE\_NOTIFICATION, etc., based on your needs. Refer to the Sinch documentation for a full list.
  • Save the webhook configuration.

(Alternative) Configure Webhook via API:

You can also create webhooks programmatically using the Sinch Webhook Management API endpoint (/v1/projects/{{PROJECT_ID}}/webhooks). This requires a valid Sinch ACCESS_TOKEN, which is typically obtained using the API credentials mentioned in the prerequisites (e.g., Service Plan ID and Token). Note: The base URL region (eu, us, apse, etc.) must match your project's region.

PROJECT_ID=""<your_sinch_project_id>""
APP_ID=""<your_sinch_app_id>""
WEBHOOK_URL=""<your_public_https_webhook_url/webhook>""
ACCESS_TOKEN=""<your_sinch_api_access_token>""
WEBHOOK_SECRET=""<your_strong_sinch_webhook_secret_here>""

curl -X POST \
  ""https://eu.conversation.api.sinch.com/v1/projects/${PROJECT_ID}/webhooks"" \
  -H 'Content-Type: application/json' \
  -H ""Authorization: Bearer ${ACCESS_TOKEN}"" \
  -d '{
        ""app_id"": ""'""${APP_ID}""'"",
        ""target"": ""'""${WEBHOOK_URL}""'"",
        ""target_type"": ""HTTP"",
        ""secret"": ""'""${WEBHOOK_SECRET}""'"",
        ""triggers"": [
          ""MESSAGE_DELIVERY"",
          ""MESSAGE_INBOUND"",
          ""EVENT_INBOUND"",
          ""CONTACT_CREATE_NOTIFICATION""
          # Add other desired triggers here
        ]
      }'

Choose the method (Portal or API) that best suits your workflow. Ensure the target URL, secret, API region, and access token are correct.

4. Verification and Testing

Let's test the setup to ensure callbacks are received and validated correctly.

1. Start Your NestJS Application:

npm run start:dev

yarn start:dev

Ensure ngrok (if used) is running and pointing to the correct local port (3000 by default).

2. Trigger Sinch Events:

  • Trigger MESSAGE_DELIVERY: Send an outbound message from your application using the Sinch Conversation API (e.g., via curl, Postman, or the Sinch API explorer) associated with the App ID where you configured the webhook. Depending on the channel (e.g., SMS, WhatsApp), Sinch should send one or more MESSAGE\_DELIVERY callbacks to your endpoint as the message progresses through QUEUED\_ON\_CHANNEL, DELIVERED, etc.
  • Trigger MESSAGE_INBOUND: Send a message to the phone number or channel identity associated with your Sinch App (e.g., send an SMS to your Sinch SMS number, or a message via WhatsApp to your Sinch WhatsApp number). Sinch should forward this as a MESSAGE\_INBOUND callback.
  • Trigger EVENT_INBOUND: Start typing a reply on a channel like WhatsApp (if EVENT\_INBOUND with composing is enabled).

3. Monitor Logs:

Observe the console output where your NestJS application is running. You should see logs similar to this upon receiving a valid callback:

log

[Nest] <PID> - <Timestamp> LOG [NestFactory] Starting Nest application...
[Nest] <PID> - <Timestamp> LOG [InstanceLoader] ConfigModule dependencies initialized <ms>
# ... other module initializations ...
[Nest] <PID> - <Timestamp> LOG [InstanceLoader] WebhookModule dependencies initialized <ms>
[Nest] <PID> - <Timestamp> LOG [InstanceLoader] AppModule dependencies initialized <ms>
[Nest] <PID> - <Timestamp> LOG [Bootstrap] Application listening on port 3000
# --- Callback Received ---
[Nest] <PID> - <Timestamp> LOG [WebhookController] Received webhook request
[Nest] <PID> - <Timestamp> LOG [WebhookController] Webhook signature validated successfully.
[Nest] <PID> - <Timestamp> LOG [WebhookService] Processing validated callback for App ID: <your_app_id>
[Nest] <PID> - <Timestamp> LOG [WebhookService] Handling Message Delivery Report: Msg ID [<message_id>], Status [<status>], Conv ID [<conversation_id>]
# OR
[Nest] <PID> - <Timestamp> LOG [WebhookService] Handling Inbound Message: Msg ID [<message_id>], Contact [<contact_id>], Conv ID [<conversation_id>], Text: ""<message_text>""
# OR
[Nest] <PID> - <Timestamp> LOG [WebhookService] Handling Inbound Event: Composing Start - Contact [<contact_id>], Conv ID [<conversation_id>]
# ... etc for other types

4. Test Invalid Signature:

  • Temporarily change the SINCH\_WEBHOOK\_SECRET in your .env file to something incorrect.
  • Restart your NestJS application.
  • Trigger another Sinch event.
  • Check the logs. You should now see:

log

[Nest] <PID> - <Timestamp> LOG [WebhookController] Received webhook request
[Nest] <PID> - <Timestamp> WARN [WebhookService] Signature mismatch. Received: <received_sig>, Expected: <calculated_sig>
[Nest] <PID> - <Timestamp> WARN [WebhookController] Invalid webhook signature received.

Your application should respond with HTTP 403 Forbidden. Remember to change the secret back and restart.

5. Check Sinch Portal:

The Sinch portal often provides logs or status indicators for webhook deliveries. Check the Webhooks section for your app to see if Sinch reports successful deliveries (HTTP 200) or failures (other codes, indicating potential issues with your endpoint URL, signature validation, or response time).

5. Troubleshooting and Caveats

  • No Callbacks Received:
  • Verify the webhook URL in the Sinch portal is correct and publicly accessible (check ngrok status or deployment URL). Use https:// prefix.
  • Ensure your server/firewall allows incoming POST requests to the /webhook path.
  • Check the Sinch portal webhook logs for delivery errors reported by Sinch.
  • Ensure the correct triggers are selected for the webhook in Sinch.
  • HMAC Validation Failures (403 Forbidden):
  • Double-check that the SINCH\_WEBHOOK\_SECRET in your .env file exactly matches the secret configured in the Sinch portal webhook settings. Regenerate/re-enter both if unsure.
  • Confirm that req.rawBody is being correctly accessed in the controller (due to rawBody: true in main.ts) and passed to the service. Ensure no other global middle

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