A Java client library for Intercom web service. This is just a tiny wrapper around Intercom API, please see Intercom API Documentation for detail.
<dependency>
<groupId>com.github.oohira</groupId>
<artifactId>intercom-java</artifactId>
<version>0.0.3</version>
</dependency>
- Google GSON (https://code.google.com/p/google-gson/)
- Apache Commons Codec (http://commons.apache.org/proper/commons-codec/)
This software is released under the MIT License, see LICENSE.txt.
Intercom intercom = new Intercom("APP_ID", "API_KEY");
User user = new User();
user.setUserId("abc123");
user.setEmail("john.doe@example.com");
user.setName("John Doe");
Company company = new Company();
company.setId("company1");
company.setName("Anonymous Company");
user.setCompanies(new Company[]{company});
intercom.createUser(user);
User user = intercom.getUserById("abc123");
Map<String, Object> customData = new LinkedHashMap<String, Object>();
customData.put("custom_data_1", "test");
customData.put("custom_data_2", 7);
user.setCustomData(customData);
intercom.updateUser(user);
for (User user : intercom.getUsers()) {
// do something
}
Tag tag = intercom.getTag("Free Trial");
tag.setUserIds(new String[]{"abc123", "def456"});
tag.setTagOrUntag("tag");
intercom.updateTag(tag);
Tag tag = intercom.getTag("Free Trial");
tag.setUserIds(new String[]{"abc123"});
tag.setTagOrUntag("untag");
intercom.updateTag(tag);
Note note = new Note();
note.setEmail("john.doe@example.com");
note.setBody("This is the text of my note.");
intercom.createNote(note);
Impression impression = new Impression();
impression.setUserId("abc123");
impression.setUserIp("127.0.0.1");
intercom.createImpression(impression);
Event event = new Event();
event.setEventName("invited-friend");
event.setUserId("abc123");
event.setCreatedAt(new Date());
Map<String, Object> metadata = new LinkedHashMap<String, Object>();
metadata.put("invitee_email", "jane.doe@example.com");
metadata.put("invite_code", "ADDAFRIEND");
event.setMetadata(metadata);
intercom.trackEvent(event);
- Message Threads API is not supported yet. Now implementing.