Frequently Asked Questions
Set up a webhook endpoint in your application to receive DLRs. Configure your Vonage account settings to send DLRs to this endpoint. Use a tool like ngrok to expose your local development server during testing. Ensure your endpoint responds with a 2xx status code to acknowledge receipt.
A DLR is a notification from Vonage that provides the delivery status of an SMS message. It confirms whether the message was successfully delivered, failed, or encountered another status like "buffered" or "expired". This allows for real-time tracking and handling of message delivery outcomes.
DLR webhooks provide real-time delivery status updates, going beyond the initial confirmation from the Vonage API. This enables accurate delivery tracking, handling failed messages, and gathering analytics on SMS campaign effectiveness, leading to a more robust and user-friendly application.
Use a switch statement or similar logic in your webhook handler to process different statuses such as 'delivered', 'failed', 'expired', etc. 'delivered' indicates success. 'failed' might require retries or support notifications. Check the 'err-code' for failure reasons. Always respond with a 2xx status code, even if your internal handling fails.
Common statuses include 'delivered', 'failed', 'expired', 'rejected', 'accepted', 'buffered', and 'unknown'. Consult Vonage documentation for the complete list and details. 'delivered' signifies successful delivery. 'failed' implies delivery failure. 'buffered' means temporary holding by the network.
Run your Node.js application and ensure ngrok is forwarding to the correct port. Send a test SMS from your Vonage number to a real mobile number. Observe the ngrok terminal for incoming webhook requests and the Node.js console for the DLR payload. Ensure your Vonage account settings point to the correct ngrok URL.
Secure your webhooks using HTTPS and a non-guessable URL path. While not foolproof, checking the 'api-key' in the payload against your Vonage key provides a basic verification step. Implement rate limiting to prevent abuse. Consult Vonage documentation for signed webhook options for added security.
Use express.json() middleware before defining your webhook route. It's crucial because Vonage sends DLR data as JSON in the POST request body. This middleware parses incoming JSON payloads and makes the data accessible on req.body for processing within your route handler.
Vonage retries webhooks if it doesn't receive a 2xx success status code (like 200 or 204) within its timeout period. Ensure your endpoint responds with a success code even if your application logic has errors. Handle any errors asynchronously after acknowledging receipt.
Verify that ngrok is running and your Vonage settings are pointed to the correct ngrok forwarding URL, including the path. Confirm that the SMS was sent from the Vonage number linked to the configured API key. Check firewall settings. Ensure the server is running and your webhook route is correctly defined.
Ngrok creates a secure tunnel from a public URL to your local development server. This allows Vonage to send webhook requests to your application running locally during development, bypassing the need for a publicly accessible server.
The 'err-code' field in the DLR payload provides specific error information when the 'status' is 'failed' or 'rejected'. A value of '0' generally indicates success. Other codes indicate different failure reasons, which can be found in the Vonage API documentation.
Ensure express.json() middleware is used before defining your webhook route. Confirm the 'Content-Type' of the incoming request is 'application/json' using your ngrok inspection interface or server-side logging.
While the standard DLR applies to SMS, DLR behavior might differ for other channels like WhatsApp or Viber used through the Vonage Messages API. Refer to the specific channel's documentation within the Messages API for details on delivery receipts.
DLR reliability varies by country and carrier network. Not all networks provide timely or accurate DLRs, and some don't offer them at all. This is a limitation of SMS technology itself. Vonage documentation provides details on country-specific capabilities.