@notifkit/provider-vonage
The Vonage (formerly Nexmo) SMS transport. Sends through the Vonage Messages API and verifies its
signed status webhooks, feeding dead numbers and STOP replies into notifkit's delivery log and
suppression list. Plain fetch, no SDK.
npm install @notifkit/provider-vonage
import { NotifkitServer } from "notifkit";
import { VonageTransport } from "@notifkit/provider-vonage";
const server = new NotifkitServer({
services: ["all"],
providers: [
new VonageTransport({
apiKey: process.env.VONAGE_API_KEY!,
apiSecret: process.env.VONAGE_API_SECRET!,
from: "+447700900001",
signatureSecret: process.env.VONAGE_SIGNATURE_SECRET,
}),
],
});
Options
| Option | Required | Notes |
|---|---|---|
apiKey | yes | API key from the Vonage Dashboard. |
apiSecret | yes | API secret from the same page. Sent as HTTP basic auth. |
from | yes | Default sender: a Vonage number in E.164 (+447700900001), or an alphanumeric sender ID (MyShop) where the destination country allows one. A template can override it. |
signatureSecret | no | The signature secret from the Dashboard's API settings. Verifies status webhooks. Without it the webhook route is not mounted, and sends go out without delivery tracking. |
logger | no | A notifkit logger instance. |
limits | no | Provider rate limit. Defaults to { limit: 75, windowSeconds: 1 }, the Messages API's default of 75 requests per second per API key. |
A recipient's sms contact target is the phone number in E.164
(+447700900000). The transport drops the +, which Vonage does not accept.
A destination with anything but digits, spaces and +().- (say, ext 12)
fails without a send, so extra digits are never dialled as part of the number.
Which template keys it reads
| Template key | Lands as |
|---|---|
text or body | The SMS text, up to 3,200 characters. A longer text is cut and ends in "…", because Vonage refuses it outright. |
from | Overrides the constructor's sender for this template. A number loses its + and formatting; an alphanumeric sender ID is sent as written. |
Status webhooks & suppressions
With signatureSecret set, the transport mounts /webhooks/vonage. To point
Vonage at it:
- In the Vonage Dashboard, open API Settings and set the Messaging API type to Messages API. On SMS API, delivery receipts keep the legacy format and never reach this route.
- Set the Messages API version to
v1. - Set the account's Status URL to the route on your notifkit API, for example
https://api.example.com/webhooks/vonage. - Copy the Signature secret from the same page into
signatureSecret.
Vonage signs every status webhook with a JWT in the Authorization: Bearer header
(HS256, keyed by the signature secret). The transport checks the signature, pins the algorithm,
and checks that the token's payload_hash matches the SHA-256 of the body, so a
captured token can't carry another body. Anything else is rejected.
| Vonage status | Becomes | Effect |
|---|---|---|
rejected with 1050, 1170, 1190, 1310 or 1430 | bounced (hard) | The number is gone: it is suppressed for future SMS. |
rejected with 1240 (STOP reply) | unsubscribed | The recipient opted out: suppressed for future SMS. |
rejected with any other code | bounced (soft) | Logged only. A block on Vonage's side, such as Fraud Defender's country block (1474), says nothing about the number. |
undeliverable | bounced (soft) | Logged only. Vonage could not reach the carrier. |
submitted, delivered | nothing | Ignored: the delivery log already records the send. |
Failed sends
| Vonage answer | What notifkit does |
|---|---|
A dead destination: 1050, 1170, 1190, 1240, 1430 | Stops retrying and, from notifkit 0.1.24, deactivates the contact. |
| Any other 4xx, such as rejected credentials or an invalid sender | Fails without a retry. A 401 never deactivates the contact: it is your own key. |
HTTP 429, or codes 1000, 1241, 1461 | Waits for capacity instead of counting a failed attempt. |
5xx, timeouts, network errors, or codes 1030, 1100, 1180, 1220, 1230, 1331 | Retried. |
Codes are listed in Vonage's Messages API error reference.
The signature covers the exact bytes Vonage sent. A proxy that re-serialises the JSON body makes payload_hash stop matching, and every webhook fails verification.