Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
  views
  state
  index.js
  package.json
  README.md
Size: Mime:
  README.md

intercom-connector

This connector provides an integration with the Intercom Javascript API. It runs a saga listening to relevant redux actions and notifies Intercom about the changes.

The Intercom Javascript API tracks our users and provides an on-site messenger: Intercom Messenger

Installation

Add the private registry:

echo "registry=https://npm-proxy.fury.io/mfsTqYdDz3bsKFQJuMAR/tmf/" >> .npmrc

Add the package to your package.json:

yarn add --save --exact @doodle/intercom-connector

Documentation

Getting started

  1. Include the EJS snippet before </body>

    <%- include(`${nodeModulesPath}/@doodle/intercom-connector/views/init.ejs`); %>
    

    In your view rendering, provide intercomAppId:

    res.render('index', {
      intercomAppId: process.env.INTERCOM_APP_ID,
      env: {
          // ... other env vars
          INTERCOM_APP_ID: process.env.INTERCOM_APP_ID,
      },
    

    In your webpack config:

    new webpack.DefinePlugin({
      'process.env': {
         // ... other env vars
         INTERCOM_APP_ID: 'window.__env__.INTERCOM_APP_ID',
      },
    }),
    
  2. Call the saga: client.js:

    store.runRootSaga({
      // ... other saga settings
      intercom: {
        intercomAppId: process.env.INTERCOM_APP_ID,
      },
    });
    

    In your root reducer:

    import { createReducer as createIntercomReducer } from '@doodle/intercom-connector';
    
    export default function createReducer(injectedReducers = {}) {
      return combineReducers({
        // other reducers
        ...createIntercomReducer(),
      });
    }
    

    In your root saga:

    import { loadIntercomSaga } from '@doodle/intercom-connector';
    
    export default function* rootSaga(options = {}, history) {
      yield all([
        // ... other sagas
        call(loadIntercomSaga, options.intercom),
      ]);
    }
    
  3. Add the Intercom App ID to the environment .env:

    INTERCOM_APP_ID=abcdef
    

    Also update this in the configmap in web-charts.

Track events

import { trackEvent } from '@doodle/intercom';

// in your saga:
yield put(trackEvent('event.name', {
    metadata_key: 'some value'
}));

Development

Login to private npm registry:

npm login
#Username: tmf
#Password:
#Email: (this IS public) tmf@doodle.com

After bumping version in package.json, publish new version:

npm publish