Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions Segment-Intercom/Classes/SEGIntercomIntegration.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#endif



@implementation SEGIntercomIntegration

#pragma mark - Initialization
Expand Down Expand Up @@ -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];");
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}

Expand Down