001// Generated by delombok at Thu Aug 13 13:56:44 UTC 2026 002/* 003 * Copyright (c) 2010-2026 Mark Allen, Norbert Bartels. 004 * 005 * Permission is hereby granted, free of charge, to any person obtaining a copy 006 * of this software and associated documentation files (the "Software"), to deal 007 * in the Software without restriction, including without limitation the rights 008 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 009 * copies of the Software, and to permit persons to whom the Software is 010 * furnished to do so, subject to the following conditions: 011 * 012 * The above copyright notice and this permission notice shall be included in 013 * all copies or substantial portions of the Software. 014 * 015 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 017 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 018 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 019 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 020 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 021 * THE SOFTWARE. 022 */ 023package com.restfb.types.webhook.messaging; 024 025import java.util.ArrayList; 026import java.util.List; 027import com.restfb.Facebook; 028 029/** 030 * Represents the 031 * <a href=" https://developers.facebook.com/docs/messenger-platform/webhook-reference/message-received">Message</a> 032 * Callback 033 */ 034public class MessageItem implements InnerMessagingItem { 035 /** 036 * Message ID 037 */ 038 @Facebook 039 private String mid; 040 /** 041 * Text of message 042 */ 043 @Facebook 044 private String text; 045 @Facebook("is_deleted") 046 private Boolean isDeleted; 047 /** 048 * not included if message is supported 049 */ 050 @Facebook("is_unsupported") 051 private Boolean isUnsupported; 052 /** 053 * Indicates the message sent from the page itself 054 */ 055 @Facebook("is_echo") 056 private boolean isEcho; 057 /** 058 * ID of the app from which the message was sent 059 */ 060 @Facebook("app_id") 061 private String appId; 062 /** 063 * Custom string passed to the Send API as the metadata field 064 */ 065 @Facebook 066 private String metadata; 067 @Facebook("quick_reply") 068 private QuickReplyItem quickReply; 069 @Facebook("sticker_id") 070 private String stickerId; 071 /** 072 * Array containing attachment data 073 */ 074 @Facebook 075 private List<MessagingAttachment> attachments = new ArrayList<>(); 076 @Facebook 077 private NlpResult nlp; 078 @Facebook("reply_to") 079 private ReplyTo replyTo; 080 081 /** 082 * The user may send a like and this method can be used to discover the three know versions of the sticker 083 * 084 * @return {@code true} if the user sent a like (thumb up sticker), {@code false} otherwise 085 */ 086 public boolean isLike() { 087 return // small like (thumb up) sticker 088 // medium size sticker 089 "369239263222822".equals(stickerId) || "369239343222814".equals(stickerId) || "369239383222810".equals(stickerId); // large size sticker 090 } 091 092 /** 093 * Returns whether the message contains an attachment. 094 * 095 * @return {@code true} if the message contains a attachment, {@code false} otherwise 096 */ 097 public boolean hasAttachment() { 098 return attachments != null && !attachments.isEmpty(); 099 } 100 101 /** 102 * Returns whether the message contains a quick reply. 103 * 104 * @return {@code true} if the message contains a quick reply, {@code false} otherwise 105 */ 106 public boolean hasQuickReply() { 107 return quickReply != null; 108 } 109 110 /** 111 * Returns whether the message contains a NLP result. 112 * 113 * @return {@code true} if the message contains a NLP result, {@code false} otherwise 114 */ 115 public boolean hasNlp() { 116 return nlp != null; 117 } 118 119 /** 120 * Returns wether the message is a reply to another message 121 * 122 * @return {@code true} if the message is a reply of another message, {@code false} otherwise 123 */ 124 public boolean isReply() { 125 return replyTo != null; 126 } 127 128 @java.lang.Override 129 @java.lang.SuppressWarnings("all") 130 @lombok.Generated 131 public java.lang.String toString() { 132 return "MessageItem(mid=" + this.getMid() + ", text=" + this.getText() + ", isDeleted=" + this.getIsDeleted() + ", isUnsupported=" + this.getIsUnsupported() + ", isEcho=" + this.isEcho() + ", appId=" + this.getAppId() + ", metadata=" + this.getMetadata() + ", quickReply=" + this.getQuickReply() + ", stickerId=" + this.getStickerId() + ", attachments=" + this.getAttachments() + ", nlp=" + this.getNlp() + ", replyTo=" + this.getReplyTo() + ")"; 133 } 134 135 /** 136 * Message ID 137 */ 138 @java.lang.SuppressWarnings("all") 139 @lombok.Generated 140 public String getMid() { 141 return this.mid; 142 } 143 144 /** 145 * Message ID 146 */ 147 @java.lang.SuppressWarnings("all") 148 @lombok.Generated 149 public void setMid(final String mid) { 150 this.mid = mid; 151 } 152 153 /** 154 * Text of message 155 */ 156 @java.lang.SuppressWarnings("all") 157 @lombok.Generated 158 public String getText() { 159 return this.text; 160 } 161 162 /** 163 * Text of message 164 */ 165 @java.lang.SuppressWarnings("all") 166 @lombok.Generated 167 public void setText(final String text) { 168 this.text = text; 169 } 170 171 @java.lang.SuppressWarnings("all") 172 @lombok.Generated 173 public Boolean getIsDeleted() { 174 return this.isDeleted; 175 } 176 177 @java.lang.SuppressWarnings("all") 178 @lombok.Generated 179 public void setIsDeleted(final Boolean isDeleted) { 180 this.isDeleted = isDeleted; 181 } 182 183 /** 184 * not included if message is supported 185 */ 186 @java.lang.SuppressWarnings("all") 187 @lombok.Generated 188 public Boolean getIsUnsupported() { 189 return this.isUnsupported; 190 } 191 192 /** 193 * not included if message is supported 194 */ 195 @java.lang.SuppressWarnings("all") 196 @lombok.Generated 197 public void setIsUnsupported(final Boolean isUnsupported) { 198 this.isUnsupported = isUnsupported; 199 } 200 201 /** 202 * Indicates the message sent from the page itself 203 */ 204 @java.lang.SuppressWarnings("all") 205 @lombok.Generated 206 public boolean isEcho() { 207 return this.isEcho; 208 } 209 210 /** 211 * Indicates the message sent from the page itself 212 */ 213 @java.lang.SuppressWarnings("all") 214 @lombok.Generated 215 public void setEcho(final boolean isEcho) { 216 this.isEcho = isEcho; 217 } 218 219 /** 220 * ID of the app from which the message was sent 221 */ 222 @java.lang.SuppressWarnings("all") 223 @lombok.Generated 224 public String getAppId() { 225 return this.appId; 226 } 227 228 /** 229 * ID of the app from which the message was sent 230 */ 231 @java.lang.SuppressWarnings("all") 232 @lombok.Generated 233 public void setAppId(final String appId) { 234 this.appId = appId; 235 } 236 237 /** 238 * Custom string passed to the Send API as the metadata field 239 */ 240 @java.lang.SuppressWarnings("all") 241 @lombok.Generated 242 public String getMetadata() { 243 return this.metadata; 244 } 245 246 /** 247 * Custom string passed to the Send API as the metadata field 248 */ 249 @java.lang.SuppressWarnings("all") 250 @lombok.Generated 251 public void setMetadata(final String metadata) { 252 this.metadata = metadata; 253 } 254 255 @java.lang.SuppressWarnings("all") 256 @lombok.Generated 257 public QuickReplyItem getQuickReply() { 258 return this.quickReply; 259 } 260 261 @java.lang.SuppressWarnings("all") 262 @lombok.Generated 263 public void setQuickReply(final QuickReplyItem quickReply) { 264 this.quickReply = quickReply; 265 } 266 267 @java.lang.SuppressWarnings("all") 268 @lombok.Generated 269 public String getStickerId() { 270 return this.stickerId; 271 } 272 273 @java.lang.SuppressWarnings("all") 274 @lombok.Generated 275 public void setStickerId(final String stickerId) { 276 this.stickerId = stickerId; 277 } 278 279 /** 280 * Array containing attachment data 281 */ 282 @java.lang.SuppressWarnings("all") 283 @lombok.Generated 284 public List<MessagingAttachment> getAttachments() { 285 return this.attachments; 286 } 287 288 /** 289 * Array containing attachment data 290 */ 291 @java.lang.SuppressWarnings("all") 292 @lombok.Generated 293 public void setAttachments(final List<MessagingAttachment> attachments) { 294 this.attachments = attachments; 295 } 296 297 @java.lang.SuppressWarnings("all") 298 @lombok.Generated 299 public NlpResult getNlp() { 300 return this.nlp; 301 } 302 303 @java.lang.SuppressWarnings("all") 304 @lombok.Generated 305 public ReplyTo getReplyTo() { 306 return this.replyTo; 307 } 308}