Description
Users can be created while also associating them with a company (as part of the same call). The response of this call contains a key called customAttributes
belonging to the companyCollection
, but this is always blank even if a bunch of custom attributes are specified.
The recommended way for viewing a company's custom attributes should be listing that company itself (that's how it also works with the plain REST API), but the Java SDK seems to be a bit confusing here. From my point of view, the company custom attributes should be removed from the response for creating an user (as that way it'll be consistent with the response received from a plain HTTP call). Alternatively, the response should just present the actual custom attributes that were passed in the call.
Version info
- intercom-java version: 2.3.3 (latest at the moment of writing this)
- Java version:
1.7.0_55
Evidence
Creating an user and associating it with a company:
String id = "20180607iii";
User user = new User().setUserId(id);
Company intercomCompany = new Company();
intercomCompany.setName("Java Company " + id);
intercomCompany.setCompanyID("co_" + id);
intercomCompany.addCustomAttribute(CustomAttribute.newStringAttribute("test_string", "testValue"));
user.addCompany(intercomCompany);
User outputUser = User.create(user);
System.out.print(outputUser);
Response of this call:
User{type='user', id='5b18f9167faf60dad73c3fdb', name='null', email='', phone='null', userId='20180607iii', avatar=Avatar{type='avatar', imageURL=null} io.intercom.api.Avatar@da2569c7, createdAt=1528363286, updatedAt=1528363286, remoteCreatedAt=0, unsubscribedFromEmails=false, sessionCount=0, lastRequestAt=0, signedUpAt=0, lastSeenIp='null', customAttributes={}, userAgentData='null', locationData=LocationData{type='location_data', city_Name='null', continentCode='null', countryCode='null', countryName='null', latitude=0.0, longitude=0.0, postalCode='null', regionName='null', timezone='null'} io.intercom.api.LocationData@3870608c, companyCollection=CompanyCollection{, totalCount=0} company.list{page=[Company{id='5b18f9167faf60dad73c3fdc', name='Java Company 20180607iii', companyID='co_20180607iii', sessionCount=0, monthlySpend=0.0, remoteCreatedAt=0, createdAt=0, updatedAt=0, plan=null, customAttributes={}, segmentCollection=SegmentCollection{} segment.list{page=[]} io.intercom.api.SegmentCollection@1d28d63a, tagCollection=TagCollection{} null{page=[]} io.intercom.api.TagCollection@3c1} io.intercom.api.Company@54b41f3c]} io.intercom.api.CompanyCollection@4ab0a80a, socialProfileCollection=SocialProfileCollection{type='social_profile.list', socialProfiles=[]} io.intercom.api.SocialProfileCollection@8311d4c, segmentCollection=SegmentCollection{} segment.list{page=[Segment{id='58ec3d7ef6f111ae22eee257', name='null', createdAt=0, updatedAt=0} io.intercom.api.Segment@21521a05, Segment{id='59f8305050ffdbf0d9f99bae', name='null', createdAt=0, updatedAt=0} io.intercom.api.Segment@986d348d]} io.intercom.api.SegmentCollection@e06b1b22, tagCollection=TagCollection{} tag.list{page=[]} io.intercom.api.TagCollection@cfc2de33, updateLastRequestAt=null, newSession=null, untag=null} io.intercom.api.User@1c5bc194
Steps to reproduce
Described in the Evidence section