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. SeeReactionimage- A media object with the image information. Added to Webhook if type is image. SeeImagesticker- A media object with the sticker information. Added to Webhook if type is sticker. SeeStickerlocation- 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. SeeButtoncontext- Added to Webhook if message is forwarded or an inbound reply. SeeContextfrom- 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. SeeTexterrors- Added to Webhook if type is unknown. SeeErrortype- 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 theMessageobjecttimestamp- 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. SeeOrdersystem- Added to Webhook if type is system. SeeSystemvideo- A media object with the video information. Added to Webhook if type is video. SeeVideoaudio- A media object with the audio information. Added to Webhook if type is audio (including voice messages). SeeAudiodocument- 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
ConstructorsConstructorDescriptionMessage(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 aMessagerecord class. -
Method Summary
Modifier and TypeMethodDescriptionaudio()Returns the value of theaudiorecord component.button()Returns the value of thebuttonrecord component.contacts()Returns the value of thecontactsrecord component.context()Returns the value of thecontextrecord component.document()Returns the value of thedocumentrecord component.final booleanIndicates whether some other object is "equal to" this one.errors()Returns the value of theerrorsrecord component.from()Returns the value of thefromrecord component.final inthashCode()Returns a hash code value for this object.id()Returns the value of theidrecord component.image()Returns the value of theimagerecord component.Returns the value of theinteractiverecord component.location()Returns the value of thelocationrecord component.order()Returns the value of theorderrecord component.reaction()Returns the value of thereactionrecord component.referral()Returns the value of thereferralrecord component.sticker()Returns the value of thestickerrecord component.system()Returns the value of thesystemrecord component.text()Returns the value of thetextrecord component.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.video()Returns the value of thevideorecord 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 aMessagerecord class.- Parameters:
reaction- the value for thereactionrecord componentimage- the value for theimagerecord componentsticker- the value for thestickerrecord componentlocation- the value for thelocationrecord componentcontacts- the value for thecontactsrecord componentbutton- the value for thebuttonrecord componentcontext- the value for thecontextrecord componentfrom- the value for thefromrecord componentid- the value for theidrecord componenttext- the value for thetextrecord componenterrors- the value for theerrorsrecord componenttype- the value for thetyperecord componentinteractive- the value for theinteractiverecord componenttimestamp- the value for thetimestamprecord componentreferral- the value for thereferralrecord componentorder- the value for theorderrecord componentsystem- the value for thesystemrecord componentvideo- the value for thevideorecord componentaudio- the value for theaudiorecord componentdocument- the value for thedocumentrecord 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 thereactionrecord component.- Returns:
- the value of the
reactionrecord component
-
image
Returns the value of theimagerecord component.- Returns:
- the value of the
imagerecord component
-
sticker
Returns the value of thestickerrecord component.- Returns:
- the value of the
stickerrecord component
-
location
Returns the value of thelocationrecord component.- Returns:
- the value of the
locationrecord component
-
contacts
Returns the value of thecontactsrecord component.- Returns:
- the value of the
contactsrecord component
-
button
Returns the value of thebuttonrecord component.- Returns:
- the value of the
buttonrecord component
-
context
Returns the value of thecontextrecord component.- Returns:
- the value of the
contextrecord component
-
from
Returns the value of thefromrecord component.- Returns:
- the value of the
fromrecord component
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
text
Returns the value of thetextrecord component.- Returns:
- the value of the
textrecord component
-
errors
Returns the value of theerrorsrecord component.- Returns:
- the value of the
errorsrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
interactive
Returns the value of theinteractiverecord component.- Returns:
- the value of the
interactiverecord component
-
timestamp
Returns the value of thetimestamprecord component.- Returns:
- the value of the
timestamprecord component
-
referral
Returns the value of thereferralrecord component.- Returns:
- the value of the
referralrecord component
-
order
Returns the value of theorderrecord component.- Returns:
- the value of the
orderrecord component
-
system
Returns the value of thesystemrecord component.- Returns:
- the value of the
systemrecord component
-
video
Returns the value of thevideorecord component.- Returns:
- the value of the
videorecord component
-
audio
Returns the value of theaudiorecord component.- Returns:
- the value of the
audiorecord component
-
document
Returns the value of thedocumentrecord component.- Returns:
- the value of the
documentrecord component
-