diff --git a/src/main/java/com/whatsapp/api/domain/messages/Context.java b/src/main/java/com/whatsapp/api/domain/messages/Context.java new file mode 100644 index 000000000..8a6a265b6 --- /dev/null +++ b/src/main/java/com/whatsapp/api/domain/messages/Context.java @@ -0,0 +1,33 @@ +package com.whatsapp.api.domain.messages; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Object that allow messages to be replied + * + * + * @see Replies +*/ +@JsonInclude(JsonInclude.Include.NON_NULL) +public class Context { + + @JsonProperty("message_id") + private String messageId; + + /** + * Gets messageId. + * + * @return the messageId + */ + public String getMessageId() { + return messageId; + } + + /** + * Sets messageId. + */ + public void setMessageId(String messageId) { + this.messageId = messageId; + } +} diff --git a/src/main/java/com/whatsapp/api/domain/messages/Message.java b/src/main/java/com/whatsapp/api/domain/messages/Message.java index 9e10e4558..0b1f4bde3 100644 --- a/src/main/java/com/whatsapp/api/domain/messages/Message.java +++ b/src/main/java/com/whatsapp/api/domain/messages/Message.java @@ -17,6 +17,8 @@ public class Message { private final String messagingProduct = "whatsapp"; @JsonProperty("recipient_type") private final String recipientType = "individual"; + @JsonProperty("context") + private Context context; /** * The Interactive message. */ @@ -58,9 +60,10 @@ public class Message { private Message() { } - private Message(String to, MessageType type) { + private Message(String to, MessageType type, Context context) { this.to = to; this.type = type; + this.context = context; } /** @@ -81,12 +84,22 @@ public String getRecipientType() { return recipientType; } + /** + * Gets context. + * + * @return the context + */ + public Context getContext() { + return context; + } + /** * The type Message builder. */ public static class MessageBuilder { private String to; + private Context context; private MessageBuilder() { @@ -112,6 +125,17 @@ public MessageBuilder setTo(String to) { return this; } + /** + * Sets context. + * + * @param context. the messsage's context. + * @return the context + */ + public MessageBuilder setContext(Context context) { + this.context = context; + return this; + } + /** * Build a text objetc, with: *