diff --git a/Segment-Intercom/Classes/SEGIntercomIntegration.m b/Segment-Intercom/Classes/SEGIntercomIntegration.m index ddfa523..6c8b68c 100644 --- a/Segment-Intercom/Classes/SEGIntercomIntegration.m +++ b/Segment-Intercom/Classes/SEGIntercomIntegration.m @@ -19,7 +19,6 @@ #endif - @implementation SEGIntercomIntegration #pragma mark - Initialization @@ -54,10 +53,12 @@ - (void)identify:(SEGIdentifyPayload *)payload { // Intercom allows users to choose to track only known or only unknown users, as well as both. Segment will support the ability to track both by checking for loggedIn users (determined by the userId) and falling back to setting the user as "Unidentified" if this is not present. if (payload.userId) { - [self.intercom registerUserWithUserId:payload.userId]; + ICMUserAttributes *attributes = [ICMUserAttributes new]; + attributes.userId = payload.userId; + [self.intercom loginUserWithUserAttributes:attributes success:nil failure:nil]; SEGLog(@"[Intercom registerUserWithUserId:%@];", payload.userId); } else if (payload.anonymousId) { - [self.intercom registerUnidentifiedUser]; + [self.intercom loginUnidentifiedUserWithSuccess:nil failure:nil]; SEGLog(@"[Intercom registerUnidentifiedUser];"); } @@ -130,14 +131,14 @@ - (void)group:(SEGGroupPayload *)payload ICMUserAttributes *userAttributes = [ICMUserAttributes new]; userAttributes.companies = @[ company ]; - [self.intercom updateUser:userAttributes]; + [self.intercom updateUser:userAttributes success:nil failure:nil]; SEGLog(@"[Intercom updateUser:%@];", userAttributes); } - (void)reset { [self.intercom reset]; - SEGLog(@" [Intercom reset];"); + SEGLog(@" [Intercom logout];"); } #pragma mark - Utils @@ -204,7 +205,7 @@ - (void)setUserAttributes:(SEGIdentifyPayload *)payload } userAttributes.customAttributes = customAttributes; - [self.intercom updateUser:userAttributes]; + [self.intercom updateUser:userAttributes success:nil failure:nil]; SEGLog(@"[Intercom updateUser:%@];", userAttributes); }