Package com.vonage.client.messages
Class InboundMessage
java.lang.Object
com.vonage.client.messages.InboundMessage
- All Implemented Interfaces:
Jsonable
Convenience class representing an inbound message webhook.
Refer to the Messages API Webhook reference for more details on the response object structure.
- Since:
- 7.2.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected InboundMessage.UrlWrapper
protected Channel
protected String
protected InboundMessage.UrlWrapper
protected String
protected InboundMessage.UrlWrapper
protected MessageType
protected UUID
protected SmsInboundMetadata
protected InboundMessage.UrlWrapper
protected String
protected Instant
protected String
protected MessageStatus.Usage
protected InboundMessage.UrlWrapper
protected InboundMessage.UrlWrapper
protected Context
protected Location
protected Order
protected Profile
protected Reply
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InboundMessage
Constructs an instance of this class from a JSON payload.If getMessageType() is MessageType.AUDIO, returns the URL of the audio.The service used to send the message.The client reference will be present if set in the original outbound message.If getMessageType() is MessageType.FILE, returns the URL of the file.getFrom()
The number this message was sent from.If getMessageType() is MessageType.IMAGE, returns the URL of the image.The media type of the message.Unique identifier of the message that was sent.If the getChannel() is Channel.SMS, returns additional information about the message.If getMessageType() is MessageType.STICKER, returns the URL of the sticker.getText()
If getMessageType() is MessageType.TEXT, returns the message text.The datetime of when the event occurred.getTo()
The number this message was sent to.This is a catch-all method which encapsulates all fields in the response JSON that are not already a field in this class.getUsage()
If the getChannel() is Channel.SMS, returns the usage information (charged incurred for the message).If getMessageType() is MessageType.VCARD, returns the URL of the vCard.If getMessageType() is MessageType.VIDEO, returns the URL of the video.If the getChannel() is Channel.WHATSAPP, returns the WhatsApp message context.If getMessageType() is MessageType.LOCATION and getChannel() is Channel.WHATSAPP, returns the location.If the getChannel() is Channel.WHATSAPP, returns information about the sender's WhatsApp profile.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vonage.client.Jsonable
toJson, updateFromJson
-
Field Details
-
unknownProperties
-
timestamp
-
channel
-
messageType
-
messageUuid
-
to
-
from
-
clientRef
-
text
-
image
-
audio
-
video
-
file
-
vcard
-
sticker
-
whatsappProfile
-
whatsappContext
-
whatsappLocation
-
whatsappReply
-
whatsappOrder
-
usage
-
smsMetadata
-
-
Constructor Details
-
InboundMessage
protected InboundMessage()
-
-
Method Details
-
getUnmappedProperties
This is a catch-all method which encapsulates all fields in the response JSON that are not already a field in this class.- Returns:
- The Map of unknown properties to their values.
-
getMessageType
The media type of the message.- Returns:
- The message type, as an enum.
-
getChannel
The service used to send the message.- Returns:
- The channel, as an enum.
-
getMessageUuid
Unique identifier of the message that was sent.- Returns:
- The UUID of the message.
-
getTo
The number this message was sent to.- Returns:
- The recipient number or ID.
-
getFrom
The number this message was sent from.- Returns:
- The sender number or ID.
-
getTimestamp
The datetime of when the event occurred.- Returns:
- The timestamp as an Instant.
-
getClientRef
The client reference will be present if set in the original outbound message.- Returns:
- The client reference, or
null
if unset.
-
getText
If getMessageType() is MessageType.TEXT, returns the message text.- Returns:
- The message text, or
null
if not applicable.
-
getImageUrl
If getMessageType() is MessageType.IMAGE, returns the URL of the image.- Returns:
- The image URL, or
null
if not applicable.
-
getAudioUrl
If getMessageType() is MessageType.AUDIO, returns the URL of the audio.- Returns:
- The audio URL, or
null
if not applicable.
-
getVideoUrl
If getMessageType() is MessageType.VIDEO, returns the URL of the video.- Returns:
- The video URL, or
null
if not applicable.
-
getFileUrl
If getMessageType() is MessageType.FILE, returns the URL of the file.- Returns:
- The file URL, or
null
if not applicable.
-
getVcardUrl
If getMessageType() is MessageType.VCARD, returns the URL of the vCard.- Returns:
- The vCard URL, or
null
if not applicable.
-
getStickerUrl
If getMessageType() is MessageType.STICKER, returns the URL of the sticker.- Returns:
- The sticker URL, or
null
if not applicable.
-
getProviderMessage
If getChannel() is Channel.WHATSAPP, returns theprovider_message
field. This is a message from the channel provider, which may contain a description, error codes or other information.- Returns:
- The provider message or
null
if not applicable.
-
getWhatsappLocation
If getMessageType() is MessageType.LOCATION and getChannel() is Channel.WHATSAPP, returns the location.- Returns:
- The deserialized WhatsApp location, or
null
if not applicable.
-
getWhatsappReply
- Returns:
- The deserialized WhatsApp reply, or
null
if not applicable.
-
getWhatsappOrder
- Returns:
- The deserialized WhatsApp order, or
null
if not applicable.
-
getWhatsappProfile
If the getChannel() is Channel.WHATSAPP, returns information about the sender's WhatsApp profile.- Returns:
- The deserialized WhatsApp profile, or
null
if not applicable.
-
getWhatsappContext
If the getChannel() is Channel.WHATSAPP, returns the WhatsApp message context. This is only present where the user is quoting another message. It provides information about the quoted message and/or the product message being responded to.- Returns:
- The deserialized WhatsApp context, or
null
if not applicable.
-
getUsage
If the getChannel() is Channel.SMS, returns the usage information (charged incurred for the message).- Returns:
- The deserialized usage object, or
null
if not applicable.
-
getSmsMetadata
If the getChannel() is Channel.SMS, returns additional information about the message.- Returns:
- The SMS metadata, or
null
if not applicable.
-
fromJson
Constructs an instance of this class from a JSON payload. Known fields will be mapped, whilst unknown fields can be manually obtained through the getUnmappedProperties() method.- Parameters:
json
- The webhook response JSON string.- Returns:
- The deserialized webhook response object.
- Throws:
VonageResponseParseException
- If the response could not be deserialized.
-