Class MessageRequestBase
Base class for all message requests. Provides common properties shared across all messaging channels.
public abstract class MessageRequestBase : IMessage
- Inheritance
-
MessageRequestBase
- Implements
- Derived
- Inherited Members
Properties
Channel
The channel to send to.
[JsonPropertyOrder(0)]
[JsonConverter(typeof(EnumDescriptionJsonConverter<MessagesChannel>))]
public abstract MessagesChannel Channel { get; }
Property Value
ClientRef
Client reference of up to 40 characters. The reference will be present in every message status.
[JsonPropertyOrder(5)]
public string ClientRef { get; set; }
Property Value
Failover
Gets or sets the failover messages to be sent if the primary message fails.
[JsonPropertyOrder(99)]
public List<IMessage> Failover { get; set; }
Property Value
From
The sender of the message. The accepted format depends on the channel of the concrete implementation (see remarks).
[JsonPropertyOrder(4)]
public string From { get; set; }
Property Value
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)]
[JsonConverter(typeof(EnumDescriptionJsonConverter<MessagesMessageType>))]
public abstract MessagesMessageType MessageType { get; }
Property Value
To
The recipient of the message. The accepted format depends on the channel of the concrete implementation (see remarks).
[JsonPropertyOrder(3)]
public string To { get; set; }
Property Value
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)]
public Uri WebhookUrl { get; set; }
Property Value
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)]
public string WebhookVersion { get; set; }
Property Value
Methods
GetErrors()
Returns any validation errors for this message. An empty collection means the message is valid.
public virtual IEnumerable<string> GetErrors()
Returns
- IEnumerable<string>
A collection of error messages.
Serialize()
Serializes the message.
public string Serialize()
Returns
- string
The serialized message.