Table of Contents

Class MessagesClient

Namespace
Vonage.Messages
Assembly
Vonage.dll

Client for sending messages across multiple channels (SMS, MMS, WhatsApp, Messenger, Viber, RCS). Implements the Vonage Messages API v1.

public class MessagesClient : IMessagesClient
Inheritance
MessagesClient
Implements
Inherited Members

Constructors

MessagesClient(Credentials)

Creates a new MessagesClient with the specified credentials.

public MessagesClient(Credentials credentials)

Parameters

credentials Credentials

The credentials used for authentication. Supports API key/secret or JWT authentication.

Methods

SendAsync(IMessage)

Sends a message through the specified channel.

public Task<MessagesResponse> SendAsync(IMessage message)

Parameters

message IMessage

The message to send. Can be any implementation of IMessage such as SmsRequest, WhatsAppTextRequest, etc.

Returns

Task<MessagesResponse>

A response containing the message UUID for tracking delivery status.

Examples

var message = new SmsRequest { To = "447700900000", From = "Vonage", Text = "Hello!" };
var response = await client.SendAsync(message);
See Also

UpdateAsync(IUpdateMessageRequest)

Updates the status of an outbound or inbound message for certain channels. For example, you can revoke outbound messages or mark inbound messages as read.

public Task UpdateAsync(IUpdateMessageRequest request)

Parameters

request IUpdateMessageRequest

The update request containing the message UUID and the desired status change.

Returns

Task

Examples

var request = new WhatsAppUpdateMessageRequest(messageUuid, UpdateStatus.Read);
await client.UpdateAsync(request);
See Also