SmsClient class

A SmsClient represents a Client to the Azure Communication Sms service allowing you to send SMS messages.

Constructors

SmsClient(string, KeyCredential, SmsClientOptions)

Initializes a new instance of the SmsClient class using an Azure KeyCredential.

SmsClient(string, SmsClientOptions)

Initializes a new instance of the SmsClient class.

SmsClient(string, TokenCredential, SmsClientOptions)

Initializes a new instance of the SmsClient class using a TokenCredential.

Methods

send(SmsSendRequest, SmsSendOptions)

Sends an SMS from a phone number that is acquired by the authenticated account, to another phone number.

Constructor Details

SmsClient(string, KeyCredential, SmsClientOptions)

Initializes a new instance of the SmsClient class using an Azure KeyCredential.

new SmsClient(endpoint: string, credential: KeyCredential, options?: SmsClientOptions)

Parameters

endpoint

string

The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).

credential
KeyCredential

An object that is used to authenticate requests to the service. Use the Azure KeyCredential or @azure/identity to create a credential.

options
SmsClientOptions

Optional. Options to configure the HTTP pipeline.

SmsClient(string, SmsClientOptions)

Initializes a new instance of the SmsClient class.

new SmsClient(connectionString: string, options?: SmsClientOptions)

Parameters

connectionString

string

Connection string to connect to an Azure Communication Service resource. Example: "endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret";

options
SmsClientOptions

Optional. Options to configure the HTTP pipeline.

SmsClient(string, TokenCredential, SmsClientOptions)

Initializes a new instance of the SmsClient class using a TokenCredential.

new SmsClient(endpoint: string, credential: TokenCredential, options?: SmsClientOptions)

Parameters

endpoint

string

The endpoint of the service (ex: https://contoso.eastus.communications.azure.net).

credential
TokenCredential

TokenCredential that is used to authenticate requests to the service.

options
SmsClientOptions

Optional. Options to configure the HTTP pipeline.

Method Details

send(SmsSendRequest, SmsSendOptions)

Sends an SMS from a phone number that is acquired by the authenticated account, to another phone number.

function send(sendRequest: SmsSendRequest, options?: SmsSendOptions): Promise<SmsSendResult[]>

Parameters

sendRequest
SmsSendRequest

Provides the sender's and recipient's phone numbers, and the contents of the message

options
SmsSendOptions

Additional request options

Returns

Promise<SmsSendResult[]>