Class MessageEvent

java.lang.Object
com.vonage.client.JsonableBaseObject
com.vonage.client.sms.MessageEvent
All Implemented Interfaces:
Jsonable

public final class MessageEvent extends JsonableBaseObject
Represents an Inbound SMS webhook.
Since:
8.3.0
  • Method Details

    • getMsisdn

      public String getMsisdn()
      The phone number that this inbound message was sent from.
      Returns:
      The sender number in E.164 format.
    • getTo

      public String getTo()
      Phone number that the message was sent to. This is your virtual number.
      Returns:
      The recipient number in E.164 format.
    • getMessageId

      public String getMessageId()
      Vonage's unique identifier for this message.
      Returns:
      The message ID.
    • getType

      public MessageType getType()
      Type of message.
      Returns:
      The message type as an enum.
    • getText

      public String getText()
      Message body for this inbound message.
      Returns:
      The text message, or null if getType() is MessageType.BINARY.
    • getKeyword

      public String getKeyword()
      The first word in the message body. This is typically used with short codes.
      Returns:
      The message keyword, or null if getType() is MessageType.BINARY.
    • getData

      public String getData()
      The binary content of this message.
      Returns:
      The message content as a string, or null if getType() is not MessageType.BINARY.
    • getUdh

      public String getUdh()
      The hex encoded user data header.
      Returns:
      The user data header as a hex-encoded string, or null if getType() is not MessageType.BINARY.
    • getMessageTimestamp

      The UTC±00:00 time when Vonage started to push this inbound message to your webhook endpoint.
      Returns:
      The message timestamp as an Instant.
    • getTimestamp

      public Long getTimestamp()
      The Unix timestamp representation of getMessageTimestamp().
      Returns:
      The Unix timestamp of the message as a Long, or null if unavailable.
    • getNonce

      public String getNonce()
      A random string that adds an extra element of unpredictability into the signature for the request. You use the nonce and timestamp parameters with your shared secret to calculate and validate the signature for inbound messages.
      Returns:
      The nonce, or null if the message is unsigned.
    • getConcat

      public Boolean getConcat()
      Whether the message exceeded the maximum-permitted length of a single message.
      Returns:
      true for multipart (concatenated) message, or null if not applicable.
    • getConcatRef

      The transaction reference. All parts of this message share this reference.
      Returns:
      The concatenation reference, or null if not applicable.
    • getConcatTotal

      The number of parts in this concatenated message.
      Returns:
      Total number of messages used, or null if not applicable.
    • getConcatPart

      The number of this part in the message. The first part of the message is 1.
      Returns:
      The sequence number (part) for this message, or null if not applicable.
    • fromJson

      public static MessageEvent fromJson(String json)
      Creates an instance of this class from a JSON payload.
      Parameters:
      json - The JSON string to parse.
      Returns:
      An instance of this class with the fields populated, if present.