A reactive wrapper for Intercom's JavaScript API
npm install --save vue-intercom
import Vue from 'vue';
import VueIntercom from 'vue-intercom';
Vue.use(VueIntercom, { appId: 'your-app-id' });
vue-intercom
handles the injection of Intercom's script into your html and wraps calls to the Intercom API with methods and exposes them through the $intercom
object in your components.
new Vue({
el: '#app',
data() {
return {
userId: 1,
name: 'Foo Bar',
email: '[email protected]',
};
},
mounted() {
this.$intercom.boot({
user_id: this.userId,
name: this.name,
email: this.email,
});
this.$intercom.show();
},
watch: {
email(email) {
this.$intercom.update({ email });
},
}
});
cd example
yarn
yarn dev
Set to true
once the Intercom script has been loaded.
Set via the onShow
/onHide
events.
Set via the onUnreadCountChange
event.
Calls Intercom('boot')
. Automatically sets the app_id
unless specified in the options object.
Calls Intercom('shutdown')
.
Calls Intercom('update')
. If the options object is set, calls Intercom('update', options)
Calls Intercom('show')
.
Calls Intercom('hide')
.
Calls Intercom('showMessages')
.
Calls Intercom('showNewMessage')
with pre-populated content if provided.
Calls Intercom('trackEvent')
with extra metadata if provided.
Calls Intercom('getVisitorId')
.
Copyright (c) 2017 Continuon