View on GitHub

Intercom-java

A Java client library for Intercom web service

Download this project as a .zip file Download this project as a tar.gz file

intercom-java

A Java client library for Intercom web service. This is just a tiny wrapper around Intercom API, please see Intercom API Documentation for detail.

Build Status

Installation

<dependency>
   <groupId>com.github.oohira</groupId>
   <artifactId>intercom-java</artifactId>
   <version>0.0.2</version>
</dependency>

Dependencies

License

This software is released under the MIT License, see LICENSE.txt.

Usage

Initialization

Intercom intercom = new Intercom("APP_ID", "API_KEY");

Users

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 HashMap<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
}

Tags

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);

Notes

Note note = new Note();
note.setEmail("john.doe@example.com");
note.setBody("This is the text of my note.");
intercom.createNote(note);

Impressions

Impression impression = new Impression();
impression.setUserId("abc123");
impression.setUserIp("127.0.0.1");
intercom.createImpression(impression);

Limitations