Class TextMessage

java.lang.Object
com.vonage.client.sms.messages.Message
com.vonage.client.sms.messages.TextMessage
All Implemented Interfaces:
QueryParamsRequest

public class TextMessage extends Message
Represents the details of a plain-text message that is to be submitted via the Vonage REST api.
  • Constructor Details

    • TextMessage

      public TextMessage(String from, String to, String messageBody)
      Instantiate a new text-message request.
      This message will be submitted as a regular 8 bit text message
      Parameters:
      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 11 chars)
      to - the phone number of the handset that you wish to send the message to
      messageBody - The text of the message to be sent to the handset
    • TextMessage

      public TextMessage(String from, String to, String messageBody, boolean unicode)
      Instantiate a new text-message request.
      This message will be submitted as a regular 8 bit text message
      Parameters:
      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 11 chars)
      to - the phone number of the handset that you wish to send the message to
      messageBody - The text of the message to be sent to the handset
      unicode - set this flag to true if the message needs to be submitted as a unicode message
  • Method Details

    • getMessageBody

      Returns:
      String The text of the message to be sent to the handset
    • isUnicode

      public boolean isUnicode()
      Returns:
      boolean This flag is set to true if the message needs to be submitted as a unicode message. This would be for scenario's where the message contains text that does not fit within the Latin GSM alphabet. Examples would be messages to be sent in non-western scripts, such as Arabic, Kanji, Chinese, etc.
    • 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
      Overrides:
      makeParams in class Message
      Returns:
      The query parameters as unique key-value pairs.