Hey! I configured Intercom using instructions for the Angular Web app. We have requirements to support visitors without logins and users with logins. So I followed your instructions and implemented it like this:
// In the AppComponent which is the root component, I added this code
import {Intercom} from '@intercom/messenger-js-sdk';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: './app.component.scss']
})
export class AppComponent implements OnInit {
ngOnInit(): void {
this.initIntercom();
}
private initIntercom(): void{
Intercom({app_id: environment.intercomSettings.app_id});
}
}
// We are calling the boot method when the user successfully logs in
boot({
'app_id': environment.intercomSettings.app_id,
'id': this.userApi.currentUser.id,
'user_id': String(this.userApi.currentUser.id),
'name': this.userApi.currentUser.name,
'email': this.userApi.currentUser.email,
'created_at': Math.floor(new Date(this.userApi.currentUser.created_at).getTime()/1000),
'Admin User': this.userApi.currentUser.is_admin,
});
// We are calling the shutdown and boot methods when the user logs out to clear a user session and start a visitor session
shutdown();
boot({app_id: environment.intercomSettings.app_id});
The problem is:
If a user (visitor without login) does not touch the Intercom widget before signing in and then a user (user logged in) logs in, there is a conversation history.
But if a user (visitor without login) touches the Intercom widget or writes a message and then a user (user logged in) logs in, there is no conversation history for him (only refreshing the page in a browser helps to get a list of all conversations).