diff --git a/api/pom.xml b/api/pom.xml
index a196969b..cfa0f21f 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -42,7 +42,7 @@
scm:git:git@github.com:messagebird/java-rest-api.git
scm:git:git@github.com:messagebird/java-rest-api.git
git@github.com:messagebird/java-rest-api.git
- HEAD
+ HEAD
diff --git a/api/src/main/java/com/messagebird/objects/ListBase.java b/api/src/main/java/com/messagebird/objects/ListBase.java
index 354eafa1..da54e709 100644
--- a/api/src/main/java/com/messagebird/objects/ListBase.java
+++ b/api/src/main/java/com/messagebird/objects/ListBase.java
@@ -13,6 +13,7 @@ public class ListBase {
private Integer limit;
private Integer totalCount;
private Links links;
+ private List items;
public ListBase() {
}
@@ -28,7 +29,6 @@ public String toString() {
'}';
}
- private List items;
public Integer getOffset() {
return offset;
diff --git a/api/src/main/java/com/messagebird/objects/MessageReference.java b/api/src/main/java/com/messagebird/objects/MessageReference.java
index da5fb596..26778292 100644
--- a/api/src/main/java/com/messagebird/objects/MessageReference.java
+++ b/api/src/main/java/com/messagebird/objects/MessageReference.java
@@ -4,6 +4,7 @@ public class MessageReference {
private String href;
private int totalCount;
+ private String lastMessageId;
public String getHREF() {
return href;
@@ -21,11 +22,16 @@ public void setTotalCount(int totalCount) {
this.totalCount = totalCount;
}
+ public String getLastMessageId() {
+ return lastMessageId;
+ }
+
@Override
public String toString() {
return "MessageReference{" +
"href='" + href + '\'' +
", totalCount=" + totalCount +
+ ", lastMessageId='" + lastMessageId + '\'' +
'}';
}
}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationChannel.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationChannel.java
index 32db29e6..2c2bd06e 100644
--- a/api/src/main/java/com/messagebird/objects/conversations/ConversationChannel.java
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationChannel.java
@@ -11,6 +11,8 @@ public class ConversationChannel {
private String id;
private String name;
+ // See: ConversationPlatformConstants
+ private String platformId;
private ConversationChannelStatus status;
private Date createdDatetime;
private Date updatedDatetime;
@@ -55,11 +57,20 @@ public void setUpdatedDatetime(final Date updatedDatetime) {
this.updatedDatetime = updatedDatetime;
}
+ public String getPlatformId() {
+ return platformId;
+ }
+
+ public void setPlatformId(String platformId) {
+ this.platformId = platformId;
+ }
+
@Override
public String toString() {
return "ConversationChannel{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
+ ", platformId=" + platformId +
", status=" + status +
", createdDatetime=" + createdDatetime +
", updatedDatetime=" + updatedDatetime +
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationContent.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationContent.java
index 2edfb5b3..9ba82bd8 100644
--- a/api/src/main/java/com/messagebird/objects/conversations/ConversationContent.java
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationContent.java
@@ -11,6 +11,7 @@ public class ConversationContent {
private ConversationContentHsm hsm;
private ConversationContentMedia image;
private ConversationContentLocation location;
+ private ConversationContentEmail email;
private String text;
private ConversationContentMedia video;
@@ -70,6 +71,14 @@ public void setVideo(ConversationContentMedia video) {
this.video = video;
}
+ public ConversationContentEmail getEmail() {
+ return email;
+ }
+
+ public void setEmail(ConversationContentEmail email) {
+ this.email = email;
+ }
+
@Override
public String toString() {
return "ConversationContent{" +
@@ -78,6 +87,7 @@ public String toString() {
", hsm=" + hsm +
", image=" + image +
", location=" + location +
+ ", email=" + email +
", text='" + text + '\'' +
", video=" + video +
'}';
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationContentEmail.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationContentEmail.java
new file mode 100644
index 00000000..3ba8b2d8
--- /dev/null
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationContentEmail.java
@@ -0,0 +1,133 @@
+package com.messagebird.objects.conversations;
+
+import java.util.List;
+import java.util.Map;
+
+public class ConversationContentEmail {
+ private String id;
+ private ConversationEmailRecipient from;
+ private List to;
+ private String subject;
+ private ConversationEmailContent content;
+ private String replyTo;
+ private String returnPath;
+ private Map headers;
+ private ConversationEmailTracking tracking;
+ private boolean performSubstitutions;
+ private List attachments;
+ private List inlineImages;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ConversationEmailRecipient getFrom() {
+ return from;
+ }
+
+ public void setFrom(ConversationEmailRecipient from) {
+ this.from = from;
+ }
+
+ public List getTo() {
+ return to;
+ }
+
+ public void setTo(List to) {
+ this.to = to;
+ }
+
+ public String getSubject() {
+ return subject;
+ }
+
+ public void setSubject(String subject) {
+ this.subject = subject;
+ }
+
+ public ConversationEmailContent getContent() {
+ return content;
+ }
+
+ public void setContent(ConversationEmailContent content) {
+ this.content = content;
+ }
+
+ public String getReplyTo() {
+ return replyTo;
+ }
+
+ public void setReplyTo(String replyTo) {
+ this.replyTo = replyTo;
+ }
+
+ public String getReturnPath() {
+ return returnPath;
+ }
+
+ public void setReturnPath(String returnPath) {
+ this.returnPath = returnPath;
+ }
+
+ public Map getHeaders() {
+ return headers;
+ }
+
+ public void setHeaders(Map headers) {
+ this.headers = headers;
+ }
+
+ public ConversationEmailTracking getTracking() {
+ return tracking;
+ }
+
+ public void setTracking(ConversationEmailTracking tracking) {
+ this.tracking = tracking;
+ }
+
+ public boolean isPerformSubstitutions() {
+ return performSubstitutions;
+ }
+
+ public void setPerformSubstitutions(boolean performSubstitutions) {
+ this.performSubstitutions = performSubstitutions;
+ }
+
+ public List getAttachments() {
+ return attachments;
+ }
+
+ public void setAttachments(List attachments) {
+ this.attachments = attachments;
+ }
+
+ public List getInlineImages() {
+ return inlineImages;
+ }
+
+ public void setInlineImages(List inlineImages) {
+ this.inlineImages = inlineImages;
+ }
+
+ @Override
+ public String toString() {
+ return "ConversationContentEmail{" +
+ "id='" + id + '\'' +
+ ", from=" + from +
+ ", to=" + to +
+ ", subject='" + subject + '\'' +
+ ", content=" + content +
+ ", replyTo='" + replyTo + '\'' +
+ ", returnPath='" + returnPath + '\'' +
+ ", headers=" + headers +
+ ", tracking=" + tracking +
+ ", performSubstitutions=" + performSubstitutions +
+ ", attachments=" + attachments +
+ ", inlineImages=" + inlineImages +
+ '}';
+ }
+}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailAttachment.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailAttachment.java
new file mode 100644
index 00000000..82e1a48a
--- /dev/null
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailAttachment.java
@@ -0,0 +1,60 @@
+package com.messagebird.objects.conversations;
+
+public class ConversationEmailAttachment {
+ private String id;
+ private String name;
+ private String type;
+ private String URL;
+ private String length;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getURL() {
+ return URL;
+ }
+
+ public void setURL(String URL) {
+ this.URL = URL;
+ }
+
+ public String getLength() {
+ return length;
+ }
+
+ public void setLength(String length) {
+ this.length = length;
+ }
+
+ @Override
+ public String toString() {
+ return "ConversationEmailAttachment{" +
+ "id='" + id + '\'' +
+ ", name='" + name + '\'' +
+ ", type='" + type + '\'' +
+ ", URL='" + URL + '\'' +
+ ", length='" + length + '\'' +
+ '}';
+ }
+}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailContent.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailContent.java
new file mode 100644
index 00000000..7127b104
--- /dev/null
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailContent.java
@@ -0,0 +1,30 @@
+package com.messagebird.objects.conversations;
+
+public class ConversationEmailContent {
+ private String html;
+ private String text;
+
+ public String getHtml() {
+ return html;
+ }
+
+ public void setHtml(String html) {
+ this.html = html;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ @Override
+ public String toString() {
+ return "ConversationEmailContent{" +
+ "html='" + html + '\'' +
+ ", text='" + text + '\'' +
+ '}';
+ }
+}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailInlineImage.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailInlineImage.java
new file mode 100644
index 00000000..a7318216
--- /dev/null
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailInlineImage.java
@@ -0,0 +1,70 @@
+package com.messagebird.objects.conversations;
+
+public class ConversationEmailInlineImage {
+ private String id;
+ private String name;
+ private String type;
+ private String URL;
+ private int length;
+ private String contentId;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getURL() {
+ return URL;
+ }
+
+ public void setURL(String URL) {
+ this.URL = URL;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ public String getContentId() {
+ return contentId;
+ }
+
+ public void setContentId(String contentId) {
+ this.contentId = contentId;
+ }
+
+ @Override
+ public String toString() {
+ return "ConversationEmailInlineImage{" +
+ "id='" + id + '\'' +
+ ", name='" + name + '\'' +
+ ", type='" + type + '\'' +
+ ", URL='" + URL + '\'' +
+ ", length=" + length +
+ ", contentId='" + contentId + '\'' +
+ '}';
+ }
+}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailRecipient.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailRecipient.java
new file mode 100644
index 00000000..bae92bfa
--- /dev/null
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailRecipient.java
@@ -0,0 +1,42 @@
+package com.messagebird.objects.conversations;
+
+import java.util.Map;
+
+public class ConversationEmailRecipient {
+ private String email;
+ private String name;
+ private Map variables;
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Map getVariables() {
+ return variables;
+ }
+
+ public void setVariables(Map variables) {
+ this.variables = variables;
+ }
+
+ @Override
+ public String toString() {
+ return "ConversationEmailRecipient{" +
+ "email='" + email + '\'' +
+ ", name='" + name + '\'' +
+ ", variables=" + variables +
+ '}';
+ }
+}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailTracking.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailTracking.java
new file mode 100644
index 00000000..b8861d14
--- /dev/null
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationEmailTracking.java
@@ -0,0 +1,30 @@
+package com.messagebird.objects.conversations;
+
+public class ConversationEmailTracking {
+ private boolean open;
+ private boolean click;
+
+ public boolean isOpen() {
+ return open;
+ }
+
+ public void setOpen(boolean open) {
+ this.open = open;
+ }
+
+ public boolean isClick() {
+ return click;
+ }
+
+ public void setClick(boolean click) {
+ this.click = click;
+ }
+
+ @Override
+ public String toString() {
+ return "ConversationEmailTracking{" +
+ "open=" + open +
+ ", click=" + click +
+ '}';
+ }
+}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationMessage.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationMessage.java
index 43b2c275..82c935dd 100644
--- a/api/src/main/java/com/messagebird/objects/conversations/ConversationMessage.java
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationMessage.java
@@ -1,6 +1,7 @@
package com.messagebird.objects.conversations;
import java.util.Date;
+import java.util.Map;
/**
* Response object that represents a conversation's message. Messages can be
@@ -18,6 +19,12 @@ public class ConversationMessage {
private ConversationContent content;
private Date createdDatetime;
private Date updatedDatetime;
+ private Map source;
+ private ConversationMessageTag tag;
+ /**
+ * See: {@link ConversationPlatformConstants}
+ */
+ private String platform;
public String getId() {
return id;
@@ -91,6 +98,30 @@ public void setUpdatedDatetime(Date updatedDatetime) {
this.updatedDatetime = updatedDatetime;
}
+ public Map getSource() {
+ return source;
+ }
+
+ public void setSource(Map source) {
+ this.source = source;
+ }
+
+ public ConversationMessageTag getTag() {
+ return tag;
+ }
+
+ public void setTag(ConversationMessageTag tag) {
+ this.tag = tag;
+ }
+
+ public String getPlatform() {
+ return platform;
+ }
+
+ public void setPlatform(String platform) {
+ this.platform = platform;
+ }
+
@Override
public String toString() {
return "ConversationMessage{" +
@@ -103,6 +134,9 @@ public String toString() {
", content=" + content +
", createdDatetime=" + createdDatetime +
", updatedDatetime=" + updatedDatetime +
+ ", source=" + source +
+ ", tag=" + tag +
+ ", platform='" + platform + '\'' +
'}';
}
}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationMessageRequest.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationMessageRequest.java
index 486589dc..626e6075 100644
--- a/api/src/main/java/com/messagebird/objects/conversations/ConversationMessageRequest.java
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationMessageRequest.java
@@ -1,5 +1,7 @@
package com.messagebird.objects.conversations;
+import java.util.Map;
+
/**
* Request object that is used to send new messages over a channel.
*/
@@ -9,6 +11,7 @@ public class ConversationMessageRequest {
private ConversationContent content;
private String channelId;
private String reportUrl;
+ private Map source;
public ConversationContentType getType() {
return type;
@@ -42,6 +45,14 @@ public void setReportUrl(String reportUrl) {
this.reportUrl = reportUrl;
}
+ public Map getSource() {
+ return source;
+ }
+
+ public void setSource(Map source) {
+ this.source = source;
+ }
+
@Override
public String toString() {
return "ConversationMessageRequest{" +
@@ -49,6 +60,7 @@ public String toString() {
", content=" + content +
", channelId='" + channelId + '\'' +
", reportUrl='" + reportUrl + '\'' +
+ ", source=" + source +
'}';
}
}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationMessageTag.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationMessageTag.java
new file mode 100644
index 00000000..49314b3c
--- /dev/null
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationMessageTag.java
@@ -0,0 +1,41 @@
+package com.messagebird.objects.conversations;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+/**
+ * These allow tagging a message based on Facebook tags.
+ * For more information visit: https://developers.facebook.com/docs/messenger-platform/send-messages/message-tags/
+ */
+public enum ConversationMessageTag {
+ EventUpdate("event.update"),
+ PurchaseUpdate("purchase.update"),
+ AccountUpdate("account.update"),
+ HumanAgent("human_agent");
+
+ @JsonValue
+ private final String tag;
+
+ ConversationMessageTag(String tag) {
+ this.tag = tag;
+ }
+
+ @JsonCreator
+ public static ConversationMessageTag forValue(final String value) {
+ for (ConversationMessageTag tag : ConversationMessageTag.values()) {
+ if (tag.getTag().equals(value)) {
+ return tag;
+ }
+ }
+ return null;
+ }
+
+ public String getTag() {
+ return tag;
+ }
+
+ @Override
+ public String toString() {
+ return tag;
+ }
+}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationPlatformConstants.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationPlatformConstants.java
new file mode 100644
index 00000000..b9c02f49
--- /dev/null
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationPlatformConstants.java
@@ -0,0 +1,33 @@
+package com.messagebird.objects.conversations;
+
+/**
+ * Platforms are communication channels that a conversation can communicate through.
+ */
+public class ConversationPlatformConstants {
+ // PlatformSMS identifies the MessageBird SMS platform.
+ public static final String SMS = "sms";
+
+ // PlatformWhatsApp identifies the WhatsApp platform.
+ public static final String WHATSAPP = "whatsapp";
+
+ // PlatformFacebook identifies the Facebook platform.
+ public static final String FACEBOOK = "facebook";
+
+ // PlatformTelegram identifies the Telegram platform.
+ public static final String TELEGRAM = "telegram";
+
+ // PlatformLine identifies the LINE platform.
+ public static final String LINE = "line";
+
+ // PlatformWeChat identifies the WeChat platform.
+ public static final String WECHAT = "wechat";
+
+ // PlatformEmail identifies the Email platform.
+ public static final String EMAIL = "email";
+
+ // PlatformEvents identifies the Events platform
+ public static final String EVENTS = "events";
+
+ // PlatformWhatsAppSandbox identified the WhatsApp sandbox platform.
+ public static final String WHATSAPP_SANDBOX = "whatsapp_sandbox";
+}
\ No newline at end of file
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationSendRequest.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationSendRequest.java
index 479edfdd..f0f9fd5c 100644
--- a/api/src/main/java/com/messagebird/objects/conversations/ConversationSendRequest.java
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationSendRequest.java
@@ -1,5 +1,7 @@
package com.messagebird.objects.conversations;
+import java.util.Map;
+
public class ConversationSendRequest {
private String to;
private ConversationContentType type;
@@ -7,20 +9,23 @@ public class ConversationSendRequest {
private String from;
private String reportUrl;
private ConversationFallbackOption fallback;
+ private Map source;
+ private ConversationMessageTag tag;
- public ConversationSendRequest(String to, ConversationContentType type, ConversationContent content, String from, String reportUrl, ConversationFallbackOption fallback) {
+ public ConversationSendRequest(String to, ConversationContentType type, ConversationContent content, String from, String reportUrl, ConversationFallbackOption fallback, Map source, ConversationMessageTag tag) {
this.to = to;
this.type = type;
this.content = content;
this.from = from;
this.reportUrl = reportUrl;
this.fallback = fallback;
+ this.source = source;
+ this.tag = tag;
}
public ConversationSendRequest() {
}
-
public String getTo() {
return to;
}
@@ -69,6 +74,22 @@ public void setFallback(ConversationFallbackOption fallback) {
this.fallback = fallback;
}
+ public Map getSource() {
+ return source;
+ }
+
+ public void setSource(Map source) {
+ this.source = source;
+ }
+
+ public ConversationMessageTag getTag() {
+ return tag;
+ }
+
+ public void setTag(ConversationMessageTag tag) {
+ this.tag = tag;
+ }
+
@Override
public String toString() {
return "ConversationSendRequest{" +
@@ -77,7 +98,9 @@ public String toString() {
", content=" + content +
", from='" + from + '\'' +
", reportUrl='" + reportUrl + '\'' +
- ", fallback=" + fallback +
+ ", fallback=" + fallback + '\'' +
+ ", tags=" + tag +
+ ", source='" + source + '\'' +
'}';
}
}
diff --git a/api/src/main/java/com/messagebird/objects/conversations/ConversationStartRequest.java b/api/src/main/java/com/messagebird/objects/conversations/ConversationStartRequest.java
index cd2151a7..36ebc68a 100644
--- a/api/src/main/java/com/messagebird/objects/conversations/ConversationStartRequest.java
+++ b/api/src/main/java/com/messagebird/objects/conversations/ConversationStartRequest.java
@@ -1,5 +1,7 @@
package com.messagebird.objects.conversations;
+import java.util.Map;
+
/**
* Request object used for starting a conversation.
*/
@@ -8,6 +10,8 @@ public class ConversationStartRequest {
private String to;
private ConversationContentType type;
private ConversationContent content;
+ private Map source;
+ private ConversationMessageTag tag;
private String channelId;
private String reportUrl;
@@ -15,12 +19,16 @@ public ConversationStartRequest(
final String to,
final ConversationContentType type,
final ConversationContent content,
- final String channelId
+ final String channelId,
+ final Map source,
+ final ConversationMessageTag tag
) {
this.to = to;
this.type = type;
this.content = content;
this.channelId = channelId;
+ this.source = source;
+ this.tag = tag;
}
public ConversationStartRequest() {
@@ -67,12 +75,30 @@ public void setReportUrl(final String reportUrl) {
this.reportUrl = reportUrl;
}
+ public Map getSource() {
+ return source;
+ }
+
+ public void setSource(Map source) {
+ this.source = source;
+ }
+
+ public ConversationMessageTag getTag() {
+ return tag;
+ }
+
+ public void setTag(ConversationMessageTag tag) {
+ this.tag = tag;
+ }
+
@Override
public String toString() {
return "ConversationStartRequest{" +
"to='" + to + '\'' +
", type=" + type +
", content=" + content +
+ ", source=" + source +
+ ", tag=" + tag +
", channelId='" + channelId + '\'' +
", reportUrl='" + reportUrl + '\'' +
'}';
diff --git a/api/src/test/java/com/messagebird/ConversationsTest.java b/api/src/test/java/com/messagebird/ConversationsTest.java
index b91b498d..81095dc3 100644
--- a/api/src/test/java/com/messagebird/ConversationsTest.java
+++ b/api/src/test/java/com/messagebird/ConversationsTest.java
@@ -6,6 +6,10 @@
import com.messagebird.objects.conversations.*;
import org.junit.Test;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
import static org.junit.Assert.*;
public class ConversationsTest {
@@ -44,11 +48,17 @@ public void testStartConversation() throws GeneralException, UnauthorizedExcepti
ConversationContent conversationContent = new ConversationContent();
conversationContent.setText("Hello world");
+ Map source = new HashMap<>();
+ source.put("agentId", "abc123");
+ source.put("userId", Arrays.asList(1, 2, 3));
+
ConversationStartRequest request = new ConversationStartRequest(
"31612345678",
ConversationContentType.TEXT,
conversationContent,
- "chanid"
+ "chanid",
+ source,
+ ConversationMessageTag.AccountUpdate
);
request.setReportUrl("https://example.com/reportUrl");
diff --git a/examples/src/main/java/ExampleConversationSendMessage.java b/examples/src/main/java/ExampleConversationSendMessage.java
index 927fbad0..84b3ca65 100644
--- a/examples/src/main/java/ExampleConversationSendMessage.java
+++ b/examples/src/main/java/ExampleConversationSendMessage.java
@@ -9,6 +9,10 @@
import com.messagebird.objects.conversations.ConversationSendRequest;
import com.messagebird.objects.conversations.ConversationSendResponse;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
public class ExampleConversationSendMessage {
public static void main(String[] args) {
@@ -32,13 +36,19 @@ public static void main(String[] args) {
ConversationContent conversationContent = new ConversationContent();
conversationContent.setText("Hello world from java sdk");
+ // Optional source parameter, that identifies the actor making the request.
+ Map source = new HashMap<>();
+ source.put("Salesman", "Sir. John Doe");
+
ConversationSendRequest request = new ConversationSendRequest(
args[1],
ConversationContentType.TEXT,
conversationContent,
args[2],
"",
- fallbackOption);
+ fallbackOption,
+ source,
+ null);
try {
ConversationSendResponse sendResponse = messageBirdClient.sendMessage(request);
diff --git a/examples/src/main/java/ExampleStartConversationsWithWhatsAppSandbox.java b/examples/src/main/java/ExampleStartConversationsWithWhatsAppSandbox.java
index 6039ac18..5c9d0e66 100644
--- a/examples/src/main/java/ExampleStartConversationsWithWhatsAppSandbox.java
+++ b/examples/src/main/java/ExampleStartConversationsWithWhatsAppSandbox.java
@@ -5,8 +5,7 @@
import com.messagebird.exceptions.UnauthorizedException;
import com.messagebird.objects.conversations.*;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
public class ExampleStartConversationsWithWhatsAppSandbox {
@@ -28,11 +27,17 @@ public static void main(String[] args) {
ConversationContent conversationContent = new ConversationContent();
conversationContent.setText("Hello world from java sdk");
+ // Optional source parameter, that identifies the actor making the request.
+ Map source = new HashMap<>();
+ source.put("agentId", "abc123");
+
ConversationStartRequest request = new ConversationStartRequest(
args[2],
ConversationContentType.TEXT,
conversationContent,
- args[1]
+ args[1],
+ source,
+ null
);
try {
Conversation conversation = messageBirdClient.startConversation(request);