Table of Contents

Interface IMessage

Namespace
Vonage.Messages
Assembly
Vonage.dll

Represents a message to be sent by an IMessageClient.

public interface IMessage

Properties

Channel

The channel to send to.

[JsonPropertyOrder(0)]
MessagesChannel Channel { get; }

Property Value

MessagesChannel

ClientRef

Client reference of up to 40 characters. The reference will be present in every message status.

[JsonPropertyOrder(5)]
string ClientRef { get; set; }

Property Value

string

Failover

Gets or sets the failover messages to be sent if the primary message fails.

[JsonPropertyOrder(99)]
List<IMessage> Failover { get; set; }

Property Value

List<IMessage>

From

The sender of the message. The accepted format depends on the channel of the concrete implementation (see remarks).

[JsonPropertyOrder(4)]
string From { get; set; }

Property Value

string

Remarks

  • SMS, MMS, WhatsApp: a phone number in E.164 format, without a leading + or 00. Start with the country code, e.g. 447700900001. For SMS, alphanumeric sender IDs are supported in certain localities.
  • RCS: an alphanumeric Sender ID that exactly matches the one registered during onboarding. Spaces are not permitted, e.g. Vonage.
  • Messenger, Viber: the sender ID (1–50 characters).
  • Email: the sender email address whose domain must be verified by Vonage before sending. A display name may be included using the format "Display Name <your.address@yourdomain.com>".

MessageType

The type of message to send.

[JsonPropertyOrder(1)]
MessagesMessageType MessageType { get; }

Property Value

MessagesMessageType

To

The recipient of the message. The accepted format depends on the channel of the concrete implementation (see remarks).

[JsonPropertyOrder(3)]
string To { get; set; }

Property Value

string

Remarks

  • SMS, MMS, RCS, Viber: a phone number in E.164 format (7–15 digits), without a leading + or 00. Start with the country code, e.g. 447700900000.
  • WhatsApp: a phone number in E.164 format without a leading +, or a WhatsApp Business-scoped User ID (BSUID), e.g. US.13491208655302741918.
  • Messenger: the recipient ID (1–50 characters).
  • Email: the recipient email address, e.g. user@example.com.

WebhookUrl

Specifies the URL to which Status Webhook messages will be sent for this particular message. Over-rides account-level and application-level Status Webhook url settings on a per-message basis.

[JsonPropertyOrder(7)]
Uri WebhookUrl { get; set; }

Property Value

Uri

WebhookVersion

Specifies which version of the Messages API will be used to send Status Webhook messages for this particular message. For example, if v0.1 is set, then the JSON body of Status Webhook messages for this message will be sent in Messages v0.1 format. Over-rides account-level and application-level API version settings on a per-message basis.

[JsonPropertyOrder(6)]
string WebhookVersion { get; set; }

Property Value

string

Methods

GetErrors()

Returns any validation errors for this message. An empty collection means the message is valid.

IEnumerable<string> GetErrors()

Returns

IEnumerable<string>

A collection of error messages.

Serialize()

Serializes the message.

string Serialize()

Returns

string

The serialized message.