Frequently Asked Questions
Use the Vonage Messages API and Node.js SDK. The `sendSms` function handles sending text messages by specifying the recipient's number, message content, your Vonage SMS number, and the 'sms' channel. Ensure numbers are in E.164 format (e.g., 14155551212).
Set up an inbound webhook URL in your Vonage application settings and handle incoming messages in your Express app's `/webhooks/inbound` endpoint. Verify the webhook signature using `@vonage/jwt` to ensure security. Always respond with a 200 OK status, even if processing fails, to prevent Vonage retries.
Use the `sendWhatsApp` function, providing recipient and message text. The 'from' number must be your Sandbox number for testing or your provisioned WhatsApp Business number for production. This leverages the `WhatsAppText` class from `@vonage/messages`.
The Vonage Messages API is a unified platform for sending and receiving messages across various channels, including SMS, MMS, WhatsApp, Viber, and Facebook Messenger. It offers a simplified way to integrate messaging into applications using a single API.
Ngrok creates a secure tunnel that exposes your locally running Express.js application to the internet, allowing Vonage to deliver webhooks to your development environment. This is essential for testing webhooks before deploying to a public server.
Allowlist your WhatsApp number by sending a specific message to the Sandbox number provided in the Vonage Dashboard. Then, configure your Sandbox webhooks (inbound and status) to point to your application's URLs (e.g., your ngrok URL during development).
A Vonage Application ID is a unique identifier assigned to your application in the Vonage Dashboard. It's essential for associating your application with your Vonage account settings, such as API keys, webhooks, and linked phone numbers.
Replace ngrok with a publicly accessible server with a static IP or domain name before deploying your application to production. Ngrok is a development tool and not suitable for production use due to its temporary URLs and security implications.
Yes, using the Vonage WhatsApp Sandbox. It's designed for development and testing purposes. For production, a WhatsApp Business Account is required.
You need `@vonage/server-sdk` (core SDK), `@vonage/messages` (Messages API SDK), and `@vonage/jwt` (for verifying webhook signatures) to interact with the Vonage Messages API effectively in your Node.js project.
Use the `verifyVonageSignature` middleware to verify the JWT (JSON Web Token) signature attached to incoming webhooks. This confirms authenticity and prevents unauthorized requests from reaching your application logic.
Vonage sends message status updates via webhooks to inform your application about the delivery status of sent messages. These updates include statuses like 'submitted', 'delivered', 'rejected', or 'undeliverable', which are crucial for monitoring message delivery.
Verify webhook signatures by extracting the JWT (JSON Web Token) from the Authorization header of the webhook request. Use the `@vonage/jwt` library with your `VONAGE_API_SIGNATURE_SECRET` to decode and verify the token, ensuring its origin and integrity.
The `.env` file stores environment variables like API keys, secrets, and configuration settings. It's essential for managing sensitive credentials securely during development and should never be committed to version control.
The `apiHost` override was typically needed with older versions of the Vonage Node.js SDK, particularly when interacting with the Sandbox. Check the official documentation; recent SDK versions mostly handle the correct endpoint automatically.
Content Loading Error
We encountered an error while processing this content.