Package com.vonage.client.messages
package com.vonage.client.messages
This package contains classes and sub-packages to support usage of the
Vonage Messages API.
The API allows sending various types of messages (text, video, image, audio, files) over various channels (SMS, MMS, Viber, WhatsApp, Facebook Messenger). Only a specific combination of message types and channels are valid, and each channel's service has varying requirements and restrictions on messages. Where feasible, these restrictions are enforced by this SDK so that requests to the API are correct by construction. That is, it should be very difficult, ideally impossible to construct a malformed MessageRequest when calling
Subclasses of
When calling
Note that the Messages Sandbox uses a different URL. Users can easily switch to this endpoint by calling
The API allows sending various types of messages (text, video, image, audio, files) over various channels (SMS, MMS, Viber, WhatsApp, Facebook Messenger). Only a specific combination of message types and channels are valid, and each channel's service has varying requirements and restrictions on messages. Where feasible, these restrictions are enforced by this SDK so that requests to the API are correct by construction. That is, it should be very difficult, ideally impossible to construct a malformed MessageRequest when calling
MessagesClient.sendMessage(com.vonage.client.messages.MessageRequest).
Hence, types are used heavily to minimize the possibility of creating invalid requests.
Subclasses of
MessageRequest explicitly exhaust all supported combinations
of message type and channel. They all follow a builder pattern to enable convenient construction of messages
with named parameters in any order. However, it is the user's responsibility to ensure that required parameters
are set before calling the MessageRequest.Builder.build() method, and to ensure
that they are sensible values. When in doubt, please consult the
API specification
for required and optional parameters, as well as requirements for valid values.
When calling
MessagesClient.sendMessage(com.vonage.client.messages.MessageRequest),
it is advised that the user catches MessageResponseException to handle cases
where the message was not sent successfully.
Note that the Messages Sandbox uses a different URL. Users can easily switch to this endpoint by calling
MessagesClient.useSandboxEndpoint().- Since:
- 6.5.0
-
ClassDescriptionUsed for inbound Button messages.Convenience interface to indicate that a media message may have a caption.CaptionMediaMessageRequest.Builder<B extends MessageRequest.Builder<? extends CaptionMediaMessageRequest,
? extends B>> Interface for builders with a media URL and caption.Represents the services available for sending messages.Convenience class representing an inbound message webhook.Convenience interface to indicate thatMessageRequest.getMessageType()is media (has a URL).MediaMessageRequest.Builder<B extends MessageRequest.Builder<? extends MediaMessageRequest,? extends B>> Interface for builders with a media URL.Abstract base class of all Messages sent via the Messages v1 API.MessageRequest.Builder<M extends MessageRequest,B extends MessageRequest.Builder<? extends M, ? extends B>> Mutable Builder class, designed to simulate named parameters to allow for convenient construction of MessageRequests.Response returned when sending a message.Response returned when sending a message fails (i.e. returns a non-2xx status code).This class represents the data of a callback which is invoked after a message has been sent.Describes the error that was encountered when sending the message.Describes the charge incurred for sending the message.Represents the possible versions used for webhooks in the Messages API.Deprecated.Convenience interface to indicate thatMessageRequest.getMessageType()isMessageType.TEXT.TextMessageRequest.Builder<B extends MessageRequest.Builder<? extends TextMessageRequest,? extends B>> Interface for builders where MessageRequest.getMessageType() isMessageType.TEXT.
MessageTypein the next major release.