Package com.whatsapp.api.domain.webhook
Record Class Message
java.lang.Object
java.lang.Record
com.whatsapp.api.domain.webhook.Message
- Record Components:
reaction
- A reaction object. SeeReaction
image
- A media object with the image information. Added to Webhook if type is image. SeeImage
sticker
- A media object with the sticker information. Added to Webhook if type is sticker. SeeSticker
location
- Locationcontacts
- Contacts- Added to Webhook if type is button. This field is used when the Webhook notifies you that a user clicked on a quick reply button. See
Button
context
- Added to Webhook if message is forwarded or an inbound reply. SeeContext
from
- The customer's phone number.id
- The unique identifier of incoming message, you can use messages endpoint to mark it as read.text
- A text object. Added to Webhook if type is text. SeeText
errors
- Added to Webhook if type is unknown. SeeError
type
- Supported values are:- text: for text messages.
- image: for image (media) messages.
- interactive: for interactive messages.
- document: for document (media) messages.
- audio: for audio and voice (media) messages.
- sticker: for sticker messages.
- order: for when a customer has placed an order.
- video: for video (media) messages.
- button: for responses to interactive message templates.
- contacts: for contact messages.
- location: for location messages.
- unknown: for unknown messages.
- system: for user number change messages.
interactive
- When a customer has interacted with your message, an interactive object is included in theMessage
objecttimestamp
- The timestamp when a customer sends a message.referral
- Added to Webhook if the message is coming from a user that clicked an ad that is Click To WhatsApp. A referral object. This is how the referral object works:- A user clicks on an ad with the Click to WhatsApp call-to-action.
- User is redirected to WhatsApp and sends a message to the advertising business.
- User sends a message to the business. Be aware that users may elect to remove their referral data.
- The advertising business gets an inbound message notification including the referral object, which provides additional context on the ad that triggered the message. Knowing all this information, the business can appropriately reply to the user message.
order
- Included in the Messages object when a customer has placed an order. SeeOrder
system
- Added to Webhook if type is system. SeeSystem
video
- A media object with the video information. Added to Webhook if type is video. SeeVideo
audio
- A media object with the audio information. Added to Webhook if type is audio (including voice messages). SeeAudio
document
- A media object with the document information. Added to Webhook if type is document. SeeDocument
public record Message(Reaction reaction, Image image, Sticker sticker, Location location, List<Contact> contacts, Button button, Context context, String from, String id, Text text, List<Error> errors, MessageType type, Interactive interactive, String timestamp, Referral referral, Order order, System system, Video video, Audio audio, Document document)
extends Record
The type Message.
-
Constructor Summary
ConstructorDescriptionMessage
(Reaction reaction, Image image, Sticker sticker, Location location, List<Contact> contacts, Button button, Context context, String from, String id, Text text, List<Error> errors, MessageType type, Interactive interactive, String timestamp, Referral referral, Order order, System system, Video video, Audio audio, Document document) Creates an instance of aMessage
record class. -
Method Summary
Modifier and TypeMethodDescriptionaudio()
Returns the value of theaudio
record component.button()
Returns the value of thebutton
record component.contacts()
Returns the value of thecontacts
record component.context()
Returns the value of thecontext
record component.document()
Returns the value of thedocument
record component.final boolean
Indicates whether some other object is "equal to" this one.errors()
Returns the value of theerrors
record component.from()
Returns the value of thefrom
record component.final int
hashCode()
Returns a hash code value for this object.id()
Returns the value of theid
record component.image()
Returns the value of theimage
record component.Returns the value of theinteractive
record component.location()
Returns the value of thelocation
record component.order()
Returns the value of theorder
record component.reaction()
Returns the value of thereaction
record component.referral()
Returns the value of thereferral
record component.sticker()
Returns the value of thesticker
record component.system()
Returns the value of thesystem
record component.text()
Returns the value of thetext
record component.Returns the value of thetimestamp
record component.final String
toString()
Returns a string representation of this record class.type()
Returns the value of thetype
record component.video()
Returns the value of thevideo
record component.
-
Constructor Details
-
Message
public Message(Reaction reaction, Image image, Sticker sticker, Location location, List<Contact> contacts, Button button, Context context, String from, String id, Text text, List<Error> errors, MessageType type, Interactive interactive, String timestamp, Referral referral, Order order, System system, Video video, Audio audio, Document document) Creates an instance of aMessage
record class.- Parameters:
reaction
- the value for thereaction
record componentimage
- the value for theimage
record componentsticker
- the value for thesticker
record componentlocation
- the value for thelocation
record componentcontacts
- the value for thecontacts
record componentbutton
- the value for thebutton
record componentcontext
- the value for thecontext
record componentfrom
- the value for thefrom
record componentid
- the value for theid
record componenttext
- the value for thetext
record componenterrors
- the value for theerrors
record componenttype
- the value for thetype
record componentinteractive
- the value for theinteractive
record componenttimestamp
- the value for thetimestamp
record componentreferral
- the value for thereferral
record componentorder
- the value for theorder
record componentsystem
- the value for thesystem
record componentvideo
- the value for thevideo
record componentaudio
- the value for theaudio
record componentdocument
- the value for thedocument
record component
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
reaction
Returns the value of thereaction
record component.- Returns:
- the value of the
reaction
record component
-
image
Returns the value of theimage
record component.- Returns:
- the value of the
image
record component
-
sticker
Returns the value of thesticker
record component.- Returns:
- the value of the
sticker
record component
-
location
Returns the value of thelocation
record component.- Returns:
- the value of the
location
record component
-
contacts
Returns the value of thecontacts
record component.- Returns:
- the value of the
contacts
record component
-
button
Returns the value of thebutton
record component.- Returns:
- the value of the
button
record component
-
context
Returns the value of thecontext
record component.- Returns:
- the value of the
context
record component
-
from
Returns the value of thefrom
record component.- Returns:
- the value of the
from
record component
-
id
Returns the value of theid
record component.- Returns:
- the value of the
id
record component
-
text
Returns the value of thetext
record component.- Returns:
- the value of the
text
record component
-
errors
Returns the value of theerrors
record component.- Returns:
- the value of the
errors
record component
-
type
Returns the value of thetype
record component.- Returns:
- the value of the
type
record component
-
interactive
Returns the value of theinteractive
record component.- Returns:
- the value of the
interactive
record component
-
timestamp
Returns the value of thetimestamp
record component.- Returns:
- the value of the
timestamp
record component
-
referral
Returns the value of thereferral
record component.- Returns:
- the value of the
referral
record component
-
order
Returns the value of theorder
record component.- Returns:
- the value of the
order
record component
-
system
Returns the value of thesystem
record component.- Returns:
- the value of the
system
record component
-
video
Returns the value of thevideo
record component.- Returns:
- the value of the
video
record component
-
audio
Returns the value of theaudio
record component.- Returns:
- the value of the
audio
record component
-
document
Returns the value of thedocument
record component.- Returns:
- the value of the
document
record component
-