Record Class Message

java.lang.Object
java.lang.Record
com.whatsapp.api.domain.webhook.Message
Record Components:
reaction - A reaction object. See Reaction
image - A media object with the image information. Added to Webhook if type is image. See Image
sticker - A media object with the sticker information. Added to Webhook if type is sticker. See Sticker
location - Location
contacts - Contacts
button - 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. See Context
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. See Text
errors - Added to Webhook if type is unknown. See Error
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 the Message object
timestamp - 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. See Order
system - Added to Webhook if type is system. See System
video - A media object with the video information. Added to Webhook if type is video. See Video
audio - A media object with the audio information. Added to Webhook if type is audio (including voice messages). See Audio
document - A media object with the document information. Added to Webhook if type is document. See Document

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 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 a Message record class.
      Parameters:
      reaction - the value for the reaction record component
      image - the value for the image record component
      sticker - the value for the sticker record component
      location - the value for the location record component
      contacts - the value for the contacts record component
      button - the value for the button record component
      context - the value for the context record component
      from - the value for the from record component
      id - the value for the id record component
      text - the value for the text record component
      errors - the value for the errors record component
      type - the value for the type record component
      interactive - the value for the interactive record component
      timestamp - the value for the timestamp record component
      referral - the value for the referral record component
      order - the value for the order record component
      system - the value for the system record component
      video - the value for the video record component
      audio - the value for the audio record component
      document - the value for the document record component
  • Method Details

    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • reaction

      public Reaction reaction()
      Returns the value of the reaction record component.
      Returns:
      the value of the reaction record component
    • image

      public Image image()
      Returns the value of the image record component.
      Returns:
      the value of the image record component
    • sticker

      public Sticker sticker()
      Returns the value of the sticker record component.
      Returns:
      the value of the sticker record component
    • location

      public Location location()
      Returns the value of the location record component.
      Returns:
      the value of the location record component
    • contacts

      public List<Contact> contacts()
      Returns the value of the contacts record component.
      Returns:
      the value of the contacts record component
    • button

      public Button button()
      Returns the value of the button record component.
      Returns:
      the value of the button record component
    • context

      public Context context()
      Returns the value of the context record component.
      Returns:
      the value of the context record component
    • from

      public String from()
      Returns the value of the from record component.
      Returns:
      the value of the from record component
    • id

      public String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • text

      public Text text()
      Returns the value of the text record component.
      Returns:
      the value of the text record component
    • errors

      public List<Error> errors()
      Returns the value of the errors record component.
      Returns:
      the value of the errors record component
    • type

      public MessageType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • interactive

      public Interactive interactive()
      Returns the value of the interactive record component.
      Returns:
      the value of the interactive record component
    • timestamp

      public String timestamp()
      Returns the value of the timestamp record component.
      Returns:
      the value of the timestamp record component
    • referral

      public Referral referral()
      Returns the value of the referral record component.
      Returns:
      the value of the referral record component
    • order

      public Order order()
      Returns the value of the order record component.
      Returns:
      the value of the order record component
    • system

      public System system()
      Returns the value of the system record component.
      Returns:
      the value of the system record component
    • video

      public Video video()
      Returns the value of the video record component.
      Returns:
      the value of the video record component
    • audio

      public Audio audio()
      Returns the value of the audio record component.
      Returns:
      the value of the audio record component
    • document

      public Document document()
      Returns the value of the document record component.
      Returns:
      the value of the document record component