Hey, the awesome guys at Intercom released an official cordova plugin. Use that instead!
$ cordova plugin add co.asku.cordova.intercom --variable API_KEY="ios_sdk-0000..." --variable APP_ID="zz..."
All functions are on the cordova.plugins.intercom
object.
Starts the user's session using their unique identifier (either or email or id).
cordova.plugins.intercom.startSession({ id: 1 });
// OR
cordova.plugins.intercom.startSession({ email: '[email protected]' });
Opens the Intercom messages list UI.
cordova.plugins.intercom.openMessages();
Updates the user properties for this user in Intercom.
cordova.plugins.intercom.updateAttributes({
name: 'Josh',
favorite_pizza: 'pepperoni'
});
Sends a user interaction event to Intercom.
cordova.plugins.intercom.logEvent('ate-pizza', {
flavor: 'cheese'
});
Tell Intercom to look for unread messages and present them to the user, overlayed on the web content. It's recommended to call this between each page view.
cordova.plugins.intercom.checkForUnreadMessages();