Table of Contents

Interface ISmsClient

Namespace
Vonage.Messaging
Assembly
Vonage.dll

Provides methods for sending SMS messages using the Vonage SMS API.

public interface ISmsClient

Methods

SendAnSmsAsync(string, string, string, SmsType, Credentials)

Sends an outbound SMS message from your Vonage account using simple parameters.

Task<SendSmsResponse> SendAnSmsAsync(string from, string to, string text, SmsType type = SmsType.Text, Credentials creds = null)

Parameters

from string

The name or number the message should be sent from. Alphanumeric sender IDs are not supported in all countries.

to string

The recipient phone number in E.164 format (e.g., 447700900000).

text string

The body of the message. Use Unicode for messages containing non-GSM characters.

type SmsType

The format of the message body. Defaults to Text.

creds Credentials

Optional credentials to override the default client credentials.

Returns

Task<SendSmsResponse>

A SendSmsResponse containing the message status and details.

Examples

var response = await client.SmsClient.SendAnSmsAsync(
    from: "Vonage",
    to: "447700900000",
    text: "Hello from Vonage!"
);
Console.WriteLine($"Message sent: {response.Messages[0].MessageId}");

Exceptions

VonageSmsResponseException

Thrown when the SMS request fails or returns a non-zero status.

See Also

SendAnSmsAsync(SendSmsRequest, Credentials)

Sends an outbound SMS message from your Vonage account.

Task<SendSmsResponse> SendAnSmsAsync(SendSmsRequest request, Credentials creds = null)

Parameters

request SendSmsRequest

The SMS request containing message details.

creds Credentials

Optional credentials to override the default client credentials.

Returns

Task<SendSmsResponse>

A SendSmsResponse containing the message status and details.

Examples

var request = new SendSmsRequest
{
    From = "Vonage",
    To = "447700900000",
    Text = "Hello from Vonage!"
};
var response = await client.SmsClient.SendAnSmsAsync(request);
Console.WriteLine($"Message ID: {response.Messages[0].MessageId}");

Exceptions

VonageSmsResponseException

Thrown when the SMS request fails or returns a non-zero status.

See Also