Skip to content

Commit d82afc5

Browse files
committed
fix user message sending
1 parent fc6aff2 commit d82afc5

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

intercom-java/src/main/java/io/intercom/api/Admin.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public static AdminCollection list()
5858
public Admin() {
5959
}
6060

61+
@JsonIgnore
6162
public String getReplyType() {
6263
return getType() + "_reply";
6364
}

intercom-java/src/main/java/io/intercom/api/User.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package io.intercom.api;
22

33

4+
import com.fasterxml.jackson.annotation.JsonIgnore;
45
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
56
import com.fasterxml.jackson.annotation.JsonInclude;
67
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -107,6 +108,7 @@ static UserUpdate buildFrom(User user) {
107108
}
108109

109110
@JsonProperty("type")
111+
@JsonInclude(JsonInclude.Include.ALWAYS)
110112
private final String type = "user";
111113

112114
@JsonProperty("id")
@@ -232,6 +234,7 @@ public Boolean isNewSession() {
232234
}
233235

234236
@JsonProperty("type")
237+
@JsonInclude(JsonInclude.Include.ALWAYS)
235238
private final String type = "user";
236239

237240
@JsonProperty("id")
@@ -316,6 +319,7 @@ boolean isUntag() {
316319
return untag == null ? false : untag;
317320
}
318321

322+
@JsonIgnore
319323
public String getReplyType() {
320324
return getType() + "_reply";
321325
}

intercom-java/src/main/java/io/intercom/api/UserMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class UserMessage extends TypedData {
1616
private final String type = "user_message";
1717

1818
@JsonProperty("message_type")
19-
private final String messageType = "inapp";
19+
private String messageType;
2020

2121
@JsonProperty("id")
2222
private String id;

intercom-java/src/test/java/io/intercom/api/UserTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ public void TestUserIncludesId() throws Exception {
5656
user.setId("5432");
5757
final String json = mapper.writeValueAsString(user);
5858
final Map map = mapper.readValue(json, Map.class);
59-
assertTrue(map.size() == 3);
59+
assertTrue(map.size() == 4);
6060
assertTrue(map.containsKey("email"));
6161
assertTrue(map.containsKey("user_id"));
6262
assertTrue(map.containsKey("id"));
63+
assertTrue(map.containsKey("type"));
6364
}
6465

6566
@Test
@@ -69,9 +70,10 @@ public void TestUserSerdesNullAndNotEmpty() throws Exception {
6970
user.setUserId("1");
7071
final String json = mapper.writeValueAsString(user);
7172
final Map map = mapper.readValue(json, Map.class);
72-
assertTrue(map.size() == 2);
73+
assertTrue(map.size() == 3);
7374
assertTrue(map.containsKey("email"));
7475
assertTrue(map.containsKey("user_id"));
76+
assertTrue(map.containsKey("type"));
7577
}
7678

7779
@Test

0 commit comments

Comments
 (0)