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 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