Class Message

java.lang.Object
com.vonage.client.sms.messages.Message
All Implemented Interfaces:
QueryParamsRequest
Direct Known Subclasses:
BinaryMessage, TextMessage

public abstract class Message extends Object implements QueryParamsRequest
Represents the details common to any message that is to be submitted to the Vonage SMS API.
  • Constructor Details

    • Message

      protected Message(Message.MessageType type, String from, String to)
    • Message

      protected Message(Message.MessageType type, String from, String to, boolean statusReportRequired)
      Abstract type for more specific SMS message types.
      This constructor exposes the full range of possible parameters and is not for general use Instead, it is accessed via super() in the constructors of various sub-classes that expose a relevant sub-set of the available parameters
      Parameters:
      type - the type of SMS message to be sent
      from - the 'from' address that will be seen on the handset when this message arrives, typically either a valid short-code / long code that can be replied to, or a short text description of the application sending the message (Max 15 chars)
      to - the phone number of the handset you wish to send the message to
      statusReportRequired - flag to enable status updates about the delivery of this message
  • Method Details

    • getType

      Returns:
      int the type of message will influence the makeup of the request we post to the Vonage server, and also the action taken by the Vonage server in response to this message
    • getFrom

      public String getFrom()
      Returns:
      String the 'from' address that will be seen on the handset when this message arrives, typically either a valid short-code / long code that can be replied to, or a short text description of the application sending the message (Max 11 chars)
    • getTo

      public String getTo()
      Returns:
      String the phone number of the handset that you wish to send the message to
    • getClientReference

      Returns:
      String A user definable value that will be stored in the Vonage sms records. It will be available in detailed reporting and analytics in order to help with reconciliation of messages
    • setClientReference

      public void setClientReference(String clientReference)
    • getMessageClass

      Returns:
      Message.MessageClass The message class that is to be applied to this message.
    • setMessageClass

      public void setMessageClass(Message.MessageClass messageClass)
    • getTimeToLive

      public Long getTimeToLive()
    • setTimeToLive

      public void setTimeToLive(Long timeToLive)
    • getCallbackUrl

    • setCallbackUrl

      public void setCallbackUrl(String callbackUrl)
    • getEntityId

      public String getEntityId()
    • setEntityId

      public void setEntityId(String entityId)
    • getContentId

      public String getContentId()
    • setContentId

      public void setContentId(String contentId)
    • getStatusReportRequired

      public boolean getStatusReportRequired()
      Returns:
      get the value of the 'status-report-req' parameter.
    • setStatusReportRequired

      public void setStatusReportRequired(boolean statusReportRequired)
      Set the value of the 'status-report-req' parameter.

      If set to 'true', Vonage will call 'callbackUrl' with status updates about the delivery of this message. If this value is set to 'true', then 'callbackUrl' should also be set to a URL that is configured to receive these status updates.

      Parameters:
      statusReportRequired - 'true' if status reports are desired, 'false' otherwise.
    • makeParams

      Description copied from interface: QueryParamsRequest
      Internal method for serializing the fields of this class into query parameters. The Map should be mutable so that subclasses can add fields, otherwise the method or implementing class should be marked as final. Duplicate entries can be handled by mapping the key to a list of the entries.
      Specified by:
      makeParams in interface QueryParamsRequest
      Returns:
      The query parameters as unique key-value pairs.