Skip to content

Vonage SMS

github-actions edited this page Oct 3, 2024 · 51 revisions

Vonage SMSDocs


Documentation / Vonage SMS

Vonage SMS

Enumerations

MessageClassEnum

Enumeration representing the possible message classes.

Defines different message classes that can be associated with SMS messages.

Enumeration Members

Enumeration Member Value Description Defined in
NUMBER_0 0 Class 0: Flash SMS. packages/sms/lib/enums/MessageClassEnum.ts:10
NUMBER_1 1 Class 1: Immediate display (user should be able to read the message instantly). packages/sms/lib/enums/MessageClassEnum.ts:15
NUMBER_2 2 Class 2: Mobile equipment-to-mobile equipment (ME-to-ME) communication. packages/sms/lib/enums/MessageClassEnum.ts:20
NUMBER_3 3 Class 3: SIM card-based storage. packages/sms/lib/enums/MessageClassEnum.ts:25

SMSStatus

Enumeration representing possible SMS status codes.

Defines different status codes that can be associated with SMS messages.

Remarks

This matches SMSErrors. Since Enums can't be joined, this is here to help check valid statuses

Enumeration Members

Enumeration Member Value Description Defined in
ACCOUNT_NOT_ENABLED "11" Account Not Enabled For HTTP: Account is not provisioned for the SMS API. packages/sms/lib/enums/SMSStatus.ts:68
BARRED_NUMBER "7" Barred Number: The number you're trying to send messages to is blocklisted. packages/sms/lib/enums/SMSStatus.ts:48
INTERNAL_ERROR "5" Internal Error: An error occurred while processing the message. packages/sms/lib/enums/SMSStatus.ts:38
INVALID_CALLBACK_URL "23" Invalid Callback URL: Callback URL is too long or contains illegal characters. packages/sms/lib/enums/SMSStatus.ts:93
INVALID_CREDENTIALS "4" Invalid Credentials: API key and/or secret are incorrect, invalid, or disabled. packages/sms/lib/enums/SMSStatus.ts:33
INVALID_MESSAGE "6" Invalid Message: The platform was unable to process the message. packages/sms/lib/enums/SMSStatus.ts:43
INVALID_NETWORK_CODE "22" Invalid Network Code: Network code is unrecognized or doesn't match the destination. packages/sms/lib/enums/SMSStatus.ts:88
INVALID_PARAM "3" Invalid Parameter: The value of one or more parameters is invalid. packages/sms/lib/enums/SMSStatus.ts:28
INVALID_SENDER_ADDRESS "15" Invalid Sender Address: Using a non-authorized sender ID in the 'from' field. packages/sms/lib/enums/SMSStatus.ts:83
INVALID_SIGNATURE "14" Invalid Signature: The supplied signature could not be verified. packages/sms/lib/enums/SMSStatus.ts:78
MESSAGE_TOO_LONG "12" Message Too Long: Message length exceeds the maximum allowed. packages/sms/lib/enums/SMSStatus.ts:73
MISSING_REQUIRED_PARAM "2" Missing Required Parameter: One or more required parameters are missing. packages/sms/lib/enums/SMSStatus.ts:23
NON_WHITELISTED_DESTINATION "29" Non-Whitelisted Destination: Vonage account is in demo mode and requires whitelisted numbers. This error is returned if you attempt to send a message to a number that isn't in your pre-approved destination list. packages/sms/lib/enums/SMSStatus.ts:100
NUMBER_DEACTIVATED "33" Number Deactivated: The number you're trying to send messages to is deactivated. packages/sms/lib/enums/SMSStatus.ts:110
PARTNER_ACCOUNT_BARRED "8" Partner Account Barred: Your Vonage account has been suspended. packages/sms/lib/enums/SMSStatus.ts:53
PARTNER_QUOTA_VIOLATION "9" Partner Quota Violation: Insufficient credit to send the message. packages/sms/lib/enums/SMSStatus.ts:58
SIGNATURE_AND_API_SECRET_DISALLOWED "32" Signature And API Secret Disallowed: A signed request may not present an API secret. packages/sms/lib/enums/SMSStatus.ts:105
SUCCESS "0" Success: The message was sent successfully. packages/sms/lib/enums/SMSStatus.ts:13
THROTTLED "1" Throttled: Sending SMS faster than the account limit. packages/sms/lib/enums/SMSStatus.ts:18
TOO_MANY_EXISTING_BINDS "10" Too Many Existing Binds: Number of simultaneous connections exceeds account allocation. packages/sms/lib/enums/SMSStatus.ts:63

TypeEnum

Enumeration representing possible message types for SMS.

Defines different message types that can be associated with SMS messages.

Enumeration Members

Enumeration Member Value Description Defined in
BINARY "binary" Binary: The message body is in binary format. packages/sms/lib/enums/TypeEnum.ts:15
TEXT "text" Text: The message body contains standard text. packages/sms/lib/enums/TypeEnum.ts:10
UNICODE "unicode" Unicode: The message body is URL-encoded Unicode, valid for various character sets. packages/sms/lib/enums/TypeEnum.ts:20

Classes

MessageSendAllFailure

Class representing a failure when sending all SMS messages.

Extends the SMSFailure class and is used to indicate that all SMS messages failed to send.

Extends

Constructors

new MessageSendAllFailure()
new MessageSendAllFailure(response): MessageSendAllFailure

Creates an instance of MessageSendAllFailure.

Parameters

response: SMSMessages

The response containing details about the failed SMS messages.

Returns

MessageSendAllFailure

Overrides

SMSFailure

Defined in

packages/sms/lib/classes/Error/MessageSendAllFailure.ts:15

Properties

cause?
optional cause: unknown;
Inherited from

SMSFailure

Defined in

node_modules/typescript/lib/lib.es2022.error.d.ts:24

message
message: string;
Inherited from

SMSFailure

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1077

name
name: string;
Inherited from

SMSFailure

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1076

response
protected response: SMSMessages;

The response containing details about the SMS messages.

Inherited from

SMSFailure

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:13

stack?
optional stack: string;
Inherited from

SMSFailure

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1078

prepareStackTrace()?
static optional prepareStackTrace: (err, stackTraces) => any;

Optional override for formatting stack traces

Parameters

err: Error

stackTraces: CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

SMSFailure

Defined in

node_modules/@types/node/globals.d.ts:143

stackTraceLimit
static stackTraceLimit: number;
Inherited from

SMSFailure

Defined in

node_modules/@types/node/globals.d.ts:145

Methods

getFailedMessages()
getFailedMessages(): ErrorMessage[]

Retrieves an array of failed messages in the response.

Returns

ErrorMessage[]

An array of failed messages in the response.

Inherited from

SMSFailure

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:40

getMessages()
getMessages(): ErrorMessage & SMSMessageResponse & object[]

Retrieves an array of all messages in the response.

Returns

ErrorMessage & object[]

An array of all messages in the response.

Inherited from

SMSFailure

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:31

getResponse()
getResponse(): SMSMessages

Retrieves the original response containing details about the SMS messages.

Returns

SMSMessages

The original response containing details about the SMS messages.

Inherited from

SMSFailure

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:51

getSuccessfulMessages()
getSuccessfulMessages(): Message[]

Retrieves an array of successfully sent messages in the response.

Returns

Message[]

An array of successfully sent messages in the response.

Inherited from

SMSFailure

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:60

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters

targetObject: object

constructorOpt?: Function

Returns

void

Inherited from

SMSFailure

Defined in

node_modules/@types/node/globals.d.ts:136


MessageSendPartialFailure

Class representing a partial failure when sending SMS messages.

Extends the SMSFailure class and is used to indicate that some SMS messages failed to send.

Extends

Constructors

new MessageSendPartialFailure()
new MessageSendPartialFailure(response): MessageSendPartialFailure

Creates an instance of MessageSendPartialFailure.

Parameters

response: SMSMessages

The response containing details about the partially failed SMS messages.

Returns

MessageSendPartialFailure

Overrides

SMSFailure

Defined in

packages/sms/lib/classes/Error/MessageSendPartialFailure.ts:15

Properties

cause?
optional cause: unknown;
Inherited from

SMSFailure

Defined in

node_modules/typescript/lib/lib.es2022.error.d.ts:24

message
message: string;
Inherited from

SMSFailure

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1077

name
name: string;
Inherited from

SMSFailure

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1076

response
protected response: SMSMessages;

The response containing details about the SMS messages.

Inherited from

SMSFailure

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:13

stack?
optional stack: string;
Inherited from

SMSFailure

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1078

prepareStackTrace()?
static optional prepareStackTrace: (err, stackTraces) => any;

Optional override for formatting stack traces

Parameters

err: Error

stackTraces: CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

SMSFailure

Defined in

node_modules/@types/node/globals.d.ts:143

stackTraceLimit
static stackTraceLimit: number;
Inherited from

SMSFailure

Defined in

node_modules/@types/node/globals.d.ts:145

Methods

getFailedMessages()
getFailedMessages(): ErrorMessage[]

Retrieves an array of failed messages in the response.

Returns

ErrorMessage[]

An array of failed messages in the response.

Inherited from

SMSFailure

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:40

getMessages()
getMessages(): ErrorMessage & SMSMessageResponse & object[]

Retrieves an array of all messages in the response.

Returns

ErrorMessage & object[]

An array of all messages in the response.

Inherited from

SMSFailure

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:31

getResponse()
getResponse(): SMSMessages

Retrieves the original response containing details about the SMS messages.

Returns

SMSMessages

The original response containing details about the SMS messages.

Inherited from

SMSFailure

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:51

getSuccessfulMessages()
getSuccessfulMessages(): Message[]

Retrieves an array of successfully sent messages in the response.

Returns

Message[]

An array of successfully sent messages in the response.

Inherited from

SMSFailure

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:60

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters

targetObject: object

constructorOpt?: Function

Returns

void

Inherited from

SMSFailure

Defined in

node_modules/@types/node/globals.d.ts:136


SMS

Client for sending legacy SMS messages using the Vonage API.

Examples

Create a standalone SMS client

import { AlgorithmTypes } from '@vonage/auth';
import { SMS } from '@vonage/sms';

const smsClient = new SMS({
 apiKey: VONAGE_API_KEY,
 apiSecret: VONAGE_API_SECRET
 secret: {
   secret: VONAGE_SIGNATURE_SECRET
   algorithm: AlgorithmTypes.sha512hmac
 },
});

Create an SMS client from the Vonage client

import { AlgorithmTypes } from '@vonage/auth';
import { Vonage } from '@vonage/server-client';

const vonage = new Vonage({
  apiKey: VONAGE_API_KEY,
  apiSecret: VONAGE_API_SECRET
  secret: {
    secret: VONAGE_SIGNATURE_SECRET
    algorithm: AlgorithmTypes.sha512hmac
  },
});

const smsClient = vonage.sms;

Extends

Constructors

new SMS()
new SMS(credentials, options?): SMS

Creates a new instance of the Client.

Parameters

credentials: AuthInterface | AuthParams

The authentication credentials or an authentication instance.

options?: ConfigParams

Optional configuration settings for the client.

Returns

SMS

Inherited from

Client.constructor

Defined in

packages/server-client/dist/lib/client.d.ts:35

Properties

auth
protected auth: AuthInterface;

The authentication instance responsible for generating authentication headers and query parameters.

Inherited from

Client.auth

Defined in

packages/server-client/dist/lib/client.d.ts:24

authType?
protected optional authType: AuthenticationType = AuthenticationType.KEY_SECRET;

The type of authentication used for the client's requests.

Overrides

Client.authType

Defined in

packages/sms/lib/sms.ts:48

config
protected config: ConfigParams;

Configuration settings for the client, including default hosts for various services and other request settings.

Inherited from

Client.config

Defined in

packages/server-client/dist/lib/client.d.ts:28

transformers
static transformers: object;

Static property containing utility transformers.

camelCaseObjectKeys
camelCaseObjectKeys: PartialTransformFunction;
kebabCaseObjectKeys
kebabCaseObjectKeys: PartialTransformFunction;
omit()
omit: (keys, obj) => TransformedObject;
Parameters

keys: string[]

obj: ObjectToTransform

Returns

TransformedObject

snakeCaseObjectKeys
snakeCaseObjectKeys: PartialTransformFunction;
Inherited from

Client.transformers

Defined in

packages/server-client/dist/lib/client.d.ts:11

Methods

addAuthenticationToRequest()
addAuthenticationToRequest(request): Promise<VetchOptions>

Adds the appropriate authentication headers or parameters to the request based on the authentication type.

Parameters

request: VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addAuthenticationToRequest

Defined in

packages/server-client/dist/lib/client.d.ts:43

addBasicAuthToRequest()
protected addBasicAuthToRequest(request): Promise<VetchOptions>

Adds basic authentication headers to the request.

Parameters

request: VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addBasicAuthToRequest

Defined in

packages/server-client/dist/lib/client.d.ts:71

addJWTToRequest()
protected addJWTToRequest(request): Promise<VetchOptions>

Adds a JWT to the request.

Parameters

request: VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addJWTToRequest

Defined in

packages/server-client/dist/lib/client.d.ts:64

addQueryKeySecretToRequest()
protected addQueryKeySecretToRequest(request): Promise<VetchOptions>

Adds API key and secret to the request.

Parameters

request: VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addQueryKeySecretToRequest

Defined in

packages/server-client/dist/lib/client.d.ts:57

addQueryKeySecretToRequestBody()
protected addQueryKeySecretToRequestBody(request): Promise<VetchOptions>

Adds API key and secret to the request body.

Parameters

request: VetchOptions

The request options to which authentication needs to be added.

Returns

Promise<VetchOptions>

  • The request options with the added authentication.
Inherited from

Client.addQueryKeySecretToRequestBody

Defined in

packages/server-client/dist/lib/client.d.ts:50

getConfig()
getConfig(): ConfigParams
Returns

ConfigParams

Inherited from

Client.getConfig

Defined in

packages/server-client/dist/lib/client.d.ts:36

parseResponse()
protected parseResponse<T>(request, response): Promise<VetchResponse<T>>

Parses the response based on its content type.

Type Parameters

T

The expected type of the parsed response data.

Parameters

request: VetchOptions

The request options.

response: Response

The raw response from the request.

Returns

Promise<VetchResponse<T>>

  • The parsed response.
Inherited from

Client.parseResponse

Defined in

packages/server-client/dist/lib/client.d.ts:168

prepareBody()
protected prepareBody(request): undefined | string

Prepares the body for the request based on the content type.

Parameters

request: VetchOptions

The request options.

Returns

undefined | string

  • The prepared request body as a string or undefined.
Inherited from

Client.prepareBody

Defined in

packages/server-client/dist/lib/client.d.ts:158

prepareRequest()
protected prepareRequest(request): Promise<VetchOptions>

Prepares the request with necessary headers, authentication, and query parameters.

Parameters

request: VetchOptions

The initial request options.

Returns

Promise<VetchOptions>

  • The modified request options.
Inherited from

Client.prepareRequest

Defined in

packages/server-client/dist/lib/client.d.ts:151

send()
send(params?): Promise<SMSMessages>

Sends an SMS message using the legacy Vonage SMS API.

Parameters

params?: SMSParams

The parameters for the SMS message.

Returns

Promise<SMSMessages>

A Promise that resolves to the response containing details about the sent SMS messages.

Throws

If all SMS messages fail to send.

Throws

If some SMS messages fail to send.

Example
const response = await smsClient.send({
  to: TO_NUMBER,
  from: FROM_NUMBER,
  text: 'Hello from Vonage SMS API',
});
console.log(`Number of messages sent: ${response.messageCount}`);); 
Defined in

packages/sms/lib/sms.ts:68

sendDeleteRequest()
sendDeleteRequest<T>(url): Promise<VetchResponse<T>>

Sends a DELETE request to the specified URL.

Type Parameters

T

Parameters

url: string

The URL endpoint for the DELETE request.

Returns

Promise<VetchResponse<T>>

  • The response from the DELETE request.
Inherited from

Client.sendDeleteRequest

Defined in

packages/server-client/dist/lib/client.d.ts:78

sendFormSubmitRequest()
sendFormSubmitRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a POST request with form data to the specified URL.

Type Parameters

T

Parameters

url: string

The URL endpoint for the POST request.

payload?: Record<string, string>

Optional payload containing form data to send with the POST request.

Returns

Promise<VetchResponse<T>>

  • The response from the POST request.
Inherited from

Client.sendFormSubmitRequest

Defined in

packages/server-client/dist/lib/client.d.ts:86

sendGetRequest()
sendGetRequest<T>(url, queryParams?): Promise<VetchResponse<T>>

Sends a GET request to the specified URL with optional query parameters.

Type Parameters

T

Parameters

url: string

The URL endpoint for the GET request.

queryParams?

Optional query parameters to append to the URL. These should be compatible with Node's URLSearchParams.

Returns

Promise<VetchResponse<T>>

  • The response from the GET request.
Inherited from

Client.sendGetRequest

Defined in

packages/server-client/dist/lib/client.d.ts:94

sendPatchRequest()
sendPatchRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a PATCH request to the specified URL with an optional payload.

Type Parameters

T

Parameters

url: string

The URL endpoint for the PATCH request.

payload?

Optional payload to be sent as the body of the PATCH request.

Returns

Promise<VetchResponse<T>>

  • The response from the PATCH request.
Inherited from

Client.sendPatchRequest

Defined in

packages/server-client/dist/lib/client.d.ts:104

sendPostRequest()
sendPostRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a POST request to the specified URL with an optional payload.

Type Parameters

T

Parameters

url: string

The URL endpoint for the POST request.

payload?

Optional payload to be sent as the body of the POST request.

Returns

Promise<VetchResponse<T>>

  • The response from the POST request.
Inherited from

Client.sendPostRequest

Defined in

packages/server-client/dist/lib/client.d.ts:114

sendPutRequest()
sendPutRequest<T>(url, payload?): Promise<VetchResponse<T>>

Sends a PUT request to the specified URL with an optional payload.

Type Parameters

T

Parameters

url: string

The URL endpoint for the PUT request.

payload?

Optional payload to be sent as the body of the PUT request.

Returns

Promise<VetchResponse<T>>

  • The response from the PUT request.
Inherited from

Client.sendPutRequest

Defined in

packages/server-client/dist/lib/client.d.ts:124

sendRequest()
sendRequest<T>(request): Promise<VetchResponse<T>>

Sends a request adding necessary headers, handling authentication, and parsing the response.

Type Parameters

T

Parameters

request: VetchOptions

The options defining the request, including URL, method, headers, and data.

Returns

Promise<VetchResponse<T>>

  • The parsed response from the request.
Inherited from

Client.sendRequest

Defined in

packages/server-client/dist/lib/client.d.ts:144

sendRequestWithData()
sendRequestWithData<T>(
   method, 
   url, 
payload?): Promise<VetchResponse<T>>

Sends a request with JSON-encoded data to the specified URL using the provided HTTP method.

Type Parameters

T

Parameters

method: POST | PUT | PATCH

The HTTP method to be used for the request (only POST, PATCH, or PUT are acceptable).

url: string

The URL endpoint for the request.

payload?

Optional payload to be sent as the body of the request, JSON-encoded.

Returns

Promise<VetchResponse<T>>

  • The response from the request.
Inherited from

Client.sendRequestWithData

Defined in

packages/server-client/dist/lib/client.d.ts:135

verifySignature()
verifySignature(
   signature, 
   params, 
   signatureSecret, 
   algorithm): boolean

Verifies the signature of a request using the specified algorithm and signature secret.

Parameters

signature: string

The signature to be verified.

params: Record<string, string>

The request parameters used to generate the signature.

signatureSecret: string

The secret key used for generating the signature.

algorithm: AlgorithmTypes

The algorithm used for generating the signature.

Returns

boolean

true if the signature is valid, false otherwise.

Remarks

This will not parse the request parameters from the request object, so you will need to do that yourself.

Throws

If the provided signature algorithm is not supported.

Example
const params = Object.assign(request.query, request.body);
const { sig } = params;

sms.verifySignature(
  sig,
  {}, // request parameters
  VONAGE_API_SIGNATURE_SECRET, 
  AlgorithmTypes.md5hash,
) === params.sig) {
  console.log("Valid signature");
} else {
  console.log("Invalid signature");
}
Defined in

packages/sms/lib/sms.ts:129


SMSFailure

Class representing a failure response when sending SMS messages.

Extends the built-in Error class and provides methods for accessing and handling failed SMS messages.

Extends

  • Error

Extended by

Constructors

new SMSFailure()
new SMSFailure(message, response): SMSFailure

Creates an instance of SMSFailure.

Parameters

message: string

The error message.

response: SMSMessages

The response containing details about the SMS messages.

Returns

SMSFailure

Overrides

Error.constructor

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:21

Properties

cause?
optional cause: unknown;
Inherited from

Error.cause

Defined in

node_modules/typescript/lib/lib.es2022.error.d.ts:24

message
message: string;
Inherited from

Error.message

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1077

name
name: string;
Inherited from

Error.name

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1076

response
protected response: SMSMessages;

The response containing details about the SMS messages.

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:13

stack?
optional stack: string;
Inherited from

Error.stack

Defined in

node_modules/typescript/lib/lib.es5.d.ts:1078

prepareStackTrace()?
static optional prepareStackTrace: (err, stackTraces) => any;

Optional override for formatting stack traces

Parameters

err: Error

stackTraces: CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace

Defined in

node_modules/@types/node/globals.d.ts:143

stackTraceLimit
static stackTraceLimit: number;
Inherited from

Error.stackTraceLimit

Defined in

node_modules/@types/node/globals.d.ts:145

Methods

getFailedMessages()
getFailedMessages(): ErrorMessage[]

Retrieves an array of failed messages in the response.

Returns

ErrorMessage[]

An array of failed messages in the response.

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:40

getMessages()
getMessages(): ErrorMessage & SMSMessageResponse & object[]

Retrieves an array of all messages in the response.

Returns

ErrorMessage & object[]

An array of all messages in the response.

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:31

getResponse()
getResponse(): SMSMessages

Retrieves the original response containing details about the SMS messages.

Returns

SMSMessages

The original response containing details about the SMS messages.

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:51

getSuccessfulMessages()
getSuccessfulMessages(): Message[]

Retrieves an array of successfully sent messages in the response.

Returns

Message[]

An array of successfully sent messages in the response.

Defined in

packages/sms/lib/classes/Error/SMSFailure.ts:60

captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters

targetObject: object

constructorOpt?: Function

Returns

void

Inherited from

Error.captureStackTrace

Defined in

node_modules/@types/node/globals.d.ts:136

Type Aliases

DeliveryReceipt

type DeliveryReceipt: object;

Interface representing a delivery receipt for an SMS message.

Describes the structure of a delivery receipt containing information about the message's delivery status.

Type declaration

apiKey?
optional apiKey: string;

The API key that sent the SMS (optional).

clientRef?
optional clientRef: string;

Your client reference for the message (optional).

errCode?
optional errCode: string;

The status of the request (optional).

messageId?
optional messageId: string;

The Vonage ID for this message (optional).

messageTimestamp?
optional messageTimestamp: string;

The time when Vonage started to push this Delivery Receipt to your webhook endpoint (optional).

msisdn?
optional msisdn: string;

The recipient's phone number in E.164 format (optional).

networkCode?
optional networkCode: string;

The Mobile Country Code Mobile Network Code (MCCMNC) of the carrier (optional).

nonce?
optional nonce: string;

A random string forming part of the signed set of parameters for validation (optional).

price?
optional price: string;

The cost of the message (optional).

scts?
optional scts: string;

When the Delivery Receipt was received from the carrier in YYMMDDHHMM format (optional).

sig?
optional sig: string;

The hash of the request parameters, a timestamp, and the signature secret (optional).

status?
optional status: string;

A code explaining the message's delivery status (optional).

timestamp?
optional timestamp: string;

A Unix timestamp representation of 'messageTimestamp' (optional).

to?
optional to: string;

The SenderID set in the 'from' field of the request (optional).

Defined in

packages/sms/lib/types/Responses/DeliveryReceipt.ts:6


ErrorMessage

type ErrorMessage: object;

Interface representing an error message.

Describes the structure of an error message containing status and error text.

Type declaration

errorText?
optional errorText: string;

The error text providing details about the error (optional).

status?
optional status: string;

The status code indicating the error (optional).

Defined in

packages/sms/lib/types/ErrorMessage.ts:6


InboundMessage

type InboundMessage: object;

Interface representing an inbound SMS message.

Describes the structure of an inbound SMS message, including its properties and details.

Type declaration

api-key
api-key: string;

The Vonage API Key of the receiving account.

concat
concat: string;

Indicates whether this is a concatenated message.

concat-part
concat-part: string;

The number of this part in the concatenated message.

concat-ref
concat-ref: string;

The transaction reference for concatenated messages.

concat-total
concat-total: string;

The total number of parts in this concatenated message.

data
data: string;

The content of this message, if the type is binary.

keyword
keyword: string;

The first word in the message body, converted to uppercase.

message-timestamp
message-timestamp: string;

The time when Vonage started to push this Inbound SMS to your webhook endpoint.

messageId
messageId: string;

The unique ID of the inbound message.

msisdn
msisdn: string;

The phone number that this inbound message was sent from in E.164 format.

nonce
nonce: string;

A random string that forms part of the signed set of parameters for validation.

text
text: string;

The message body for this inbound message.

timestamp
timestamp: string;

A Unix timestamp representation of 'message-timestamp'.

to
to: string;

The phone number the message was sent to (virtual number) in E.164 format.

type
type: TypeEnum | string;

The format of the message body.

udh
udh: string;

The hex encoded User Data Header, if the type is binary.

Defined in

packages/sms/lib/types/InboundMessage.ts:8


Message

type Message: SMSMessageResponse & object;

Type representing an SMS message.

Extends the structure of an SMS message response and includes additional optional properties.

Type declaration

accountRef?
optional accountRef: string;

An optional string used to identify separate accounts using the SMS endpoint for billing purposes (optional).

clientRef?
optional clientRef: string;

Your client reference for the message (optional).

messageId?
optional messageId: string;

The unique ID of the SMS message (optional).

messagePrice?
optional messagePrice: string;

The estimated cost of the SMS message (optional).

remainingBalance?
optional remainingBalance: string;

Your estimated remaining balance after sending the SMS (optional).

Defined in

packages/sms/lib/types/Message.ts:8


SendSMSResponse

type SendSMSResponse: SMSResponse;

Deprecated type alias for SMSResponse.

Please use SMSResponse instead.

Deprecated

Use SMSResponse instead.

Defined in

packages/sms/lib/types/Responses/SendSMSResponse.ts:10


SMSEmptyResponse

type SMSEmptyResponse: object;

Deprecated interface for an empty SMS response.

Type declaration

errorCode?
optional errorCode: string;

The error code, if applicable (optional).

errorCodeLabel?
optional errorCodeLabel: string;

A label for the error code, if provided (optional).

Deprecated

There is no substitution for this interface.

Defined in

packages/sms/lib/types/Responses/SMSEmptyResponse.ts:6


SMSGeneralResponse

type SMSGeneralResponse: SMSResponse;

Deprecated type alias for SMSResponse.

Please use SMSResponse instead.

Deprecated

Use SMSResponse instead.

Defined in

packages/sms/lib/types/Responses/SMSGeneralResponse.ts:10


SMSMessageResponse

type SMSMessageResponse: object;

Interface representing an SMS message response.

Describes the structure of a response containing information about an SMS message's status and details.

Type declaration

account-ref?
optional account-ref: string;

An optional string used to identify separate accounts using the SMS endpoint for billing purposes (optional).

client-ref?
optional client-ref: string;

Your client reference for the message (optional).

message-id
message-id: string;

The unique ID of the SMS message.

message-price
message-price: string;

The estimated cost of the SMS message.

network
network: string;

The estimated ID of the network of the recipient.

remaining-balance
remaining-balance: string;

Your estimated remaining balance after sending the SMS.

status
status: SMSStatus;

The status of the SMS message.

to
to: string;

The recipient's phone number in E.164 format.

Defined in

packages/sms/lib/types/Responses/SMSMessageResponse.ts:7


SMSMessages

type SMSMessages: SMSResponse & object;

Interface representing an SMS response containing multiple messages, including errors.

Extends the structure of an SMS response and includes additional properties for message count and an array of messages, which can include both valid messages and error messages.

Type declaration

messageCount
messageCount: number;

The count of messages included in the response.

messages
messages: Message & ErrorMessage[];

An array of messages, which can include both valid messages and error messages.

Defined in

packages/sms/lib/types/SMSMessages.ts:13


SMSParams

type SMSParams: object;

Type representing parameters for sending an SMS.

Describes the structure of parameters that can be used when sending an SMS, including sender, recipient, message content, and additional options.

Type declaration

accountRef?
optional accountRef: string;

An optional string used to identify separate accounts using the SMS endpoint for billing purposes (optional).

body?
optional body: string;

The binary body of the message (optional).

callback?
optional callback: string;

The webhook callback URL for receiving delivery receipts (optional).

clientRef?
optional clientRef: string;

Your client reference for the message (optional).

contentId?
optional contentId: string;

An optional content ID for regulatory requirements (optional).

entityId?
optional entityId: string;

An optional entity ID for regulatory requirements (optional).

from
from: string;

The sender's phone number or name.

messageClass?
optional messageClass: MessageClassEnum;

The message class (optional).

protocolId?
optional protocolId: number;

The protocol identifier for binary messages (optional).

statusReportReq?
optional statusReportReq: boolean;

Indicates if a delivery receipt is requested (optional).

text?
optional text: string;

The text content of the SMS message (optional).

title?
optional title: string;

The title of the message (optional).

to
to: string;

The recipient's phone number in E.164 format.

ttl?
optional ttl: number;

The time-to-live (TTL) duration in milliseconds for delivery attempts (optional).

type?
optional type: TypeEnum;

The format of the message body (optional).

udh?
optional udh: string;

The User Data Header (UDH) for binary messages (optional).

url?
optional url: string;

The URL for WAP Push messages (optional).

validity?
optional validity: string;

The validity period of the message (optional).

Defined in

packages/sms/lib/types/SMSParams.ts:9


SMSRequestBody

type SMSRequestBody: object;

Interface representing the request body for sending an SMS.

Describes the structure of the request body used when sending an SMS message.

Type declaration

body?
optional body: string;

Hex-encoded binary data (optional).

callback?
callback?: string;

The webhook endpoint for the delivery receipt (optional).

client_ref?
client_ref?: string;

Your own reference for the message (optional).

client-ref?
optional client-ref: string;

Your own reference for the message (optional).

content-id?
optional content-id: string;

A string parameter for regulatory requirements (optional).

entity-id?
optional entity-id: string;

A string parameter for regulatory requirements (optional).

from
from: string;

The Alphanumeric senderID (if supported for the destination) or virtual number (specified in E.164 format) that the SMS is being sent from.

message_class?
message_class?: number;

The Data Coding Scheme value of the message (optional).

message-class?
optional message-class: MessageClassEnum;

The Data Coding Scheme value of the message (optional).

protocol-id?
optional protocol-id: number;

The value of the protocol identifier to use (optional).

status-report-req?
optional status-report-req: boolean;

Boolean indicating if a Delivery Receipt is requested (optional).

text?
optional text: string;

The body of the message being sent (optional).

to
to: string;

The recipient's phone number in E.164 format.

ttl?
ttl?: number;

The duration in milliseconds for delivery attempts (optional).

type?
type?: TypeEnum;

The format of the message body (optional).

udh?
udh?: string;

Custom Hex-encoded User Data Header (optional).

Defined in

packages/sms/lib/types/Requests/SMSRequestBody.ts:8


SMSResponse

type SMSResponse: object;

Interface representing an SMS response.

Describes the structure of a response containing information about SMS messages or error messages.

Type declaration

message-count
message-count: number;

The count of messages included in the response.

messages
messages: SMSMessageResponse[] | SMSErrorMessageResponse[];

An array of SMS message responses or SMS error message responses.

Defined in

packages/sms/lib/types/Responses/SMSResponse.ts:9

Variables

COLLECTION_FORMATS

const COLLECTION_FORMATS: object;

Collection Formats for API Parameter Serialization.

Defines various collection formats used for serializing API parameters.

Type declaration

csv
csv: string = ',';

Comma-separated values collection format.

pipes
pipes: string = '|';

Pipe-separated values collection format.

ssv
ssv: string = ' ';

Space-separated values collection format.

tsv
tsv: string = '\t';

Tab-separated values collection format.

Defined in

packages/sms/lib/enums/CollectionFormats.ts:6

Clone this wiki locally