Integrate intercom with Ionic/ Angular app

Hello!

I want to add Intercom’s chat feature in my app. I have followed some guides: https://github.com/intercom/intercom-cordova, https://ionicframework.com/docs/native/intercom/ and Intercom’s own guide, however I can’t get it to work.

If you have done this before you’ll know that you need to add this first:

<preference name="intercom-app-id" value="APP-ID"></preference>
<preference name="intercom-ios-api-key" value="ios_sdk-API"></preference>
<preference name="intercom-android-api-key" value="android_sdk-API2"></preference>

In your cofig.xml which I’ve done, but the second step doesn’t want to work out for me. And the second step is to add some functions in order to make Intercom to work. Here’s one of them:

onDeviceReady: function() {
  if(loggedIn){
      // We're logged in, we can register the user with Intercom
      intercom.registerIdentifiedUser({userId: "123456"});
  }
}

This function should be placed where the app launches. And if I’m not wrong here is where it should be placed:

$ionicPlatform.ready(function () {

I’ve been struggling with this the whole day and I just want this to work. I want this feature to work with logged in users ONLY by the way. If someone has any clue on how to do this I would be really, really happy.

Thank you for reading.

Instructions on [quote=“martinnord, post:1, topic:94352”]
, https://ionicframework.com/docs/native/intercom/
[/quote] are for Ionic Angular (so v2+).

Better use the plugin documentation: https://github.com/intercom/intercom-cordova#ionic-1

Hello @Sujan12! Thank you for taking your time to answer my question.

So you are saying that if I follow the plugin documentation, Intercom will work just fine? Because I’ve ran this: cordova plugin add cordova-plugin-intercom, I’ve initialized Intercom in my config.xml file and added these lines:

 cordova.plugins.intercom.registerIdentifiedUser({userId: "123456"}); 
 cordova.plugins.intercom.setLauncherVisibility('VISIBLE');

In my app.js file it looks like this:

But nothing seems to be working for me! :frowning: