Frequently Asked Questions
Use the Vonage Messages API with the official Node.js SDK (@vonage/server-sdk). The `vonage.messages.send` method handles sending, supporting various message channels and providing robust delivery receipts. You'll need a Vonage API account, application, and rented number.
The Vonage Messages API is a versatile tool for sending and receiving messages across different channels, including SMS. It's used in this project for its reliable delivery tracking and webhook features, enabling real-time status updates and inbound message handling.
The Application ID and Private Key are required for authenticating with the Vonage Messages API and sending messages securely. This method is preferred over API Key/Secret for sending, although the latter might be needed for other Vonage API interactions or webhook signature verification.
Use ngrok during development to create a publicly accessible URL for your local server so Vonage can reach your webhook endpoints. Remember that ngrok URLs change frequently on the free tier, requiring updates in your Vonage Application settings.
While a simple in-memory store (like a Map) can be used for initial development, it's not suitable for production. Data will be lost on server restarts. Use a persistent database like PostgreSQL with Prisma for reliable data storage in a real-world application.
Set up a status webhook URL in your Vonage Application settings. Vonage will send POST requests to this endpoint with delivery updates. Use the `client_ref` parameter when sending messages to correlate statuses back to specific campaigns and contacts.
The `client_ref` is a custom identifier you can attach to outgoing messages. It's crucial for tracking message status and correlating webhooks back to your internal data. A good format is 'campaignId:contactId'.
Configure an inbound webhook URL in your Vonage Application settings. Implement logic in your webhook handler to process inbound SMS messages containing keywords like "STOP". Update the contact's status to "opted-out" to prevent future messages.
JWT (JSON Web Token) is a secure method for verifying the authenticity of webhooks. It ensures that incoming requests genuinely originate from Vonage, preventing unauthorized access or malicious activity. The specific Vonage JWT/signature check implementation depends on the current SDK guidance.
A job queue (like BullMQ with Redis) is essential for production SMS campaign sending. It handles asynchronous processing reliably, manages retries in case of failures, and enables proper concurrency control, unlike setImmediate which is unsafe and non-persistent
Vonage often has default rate limits (e.g., 1 message per second per long code). Implement delays between sending messages using `setTimeout` or similar methods. Adjust the delay based on your number type and account-specific limits. See Vonage documentation for details.
You'll need Node.js, npm (or yarn), a Vonage API account, a Vonage Application enabled for the Messages API with a Private Key, a rented Vonage Number, ngrok for local development, and basic JavaScript/Node.js knowledge, including async/await.
Create a new application in the Vonage dashboard, enable the "Messages" capability, configure Status and Inbound webhook URLs, generate and download the private key, note the Application ID, and link your Vonage Number to the application.
Prisma is an Object-Relational Mapper (ORM) that simplifies database interactions in Node.js. It makes it easier to work with PostgreSQL or other databases by providing a type-safe and convenient way to query and manage data.
Content Loading Error
We encountered an error while processing this content.