How to use the intercom-client.Client function in intercom-client

To help you get started, we’ve selected a few intercom-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codecombat / codecombat / scripts / deleteInactiveIntercomUsers.js View on Github external
process.exit();

if (process.argv.length !== 3) {
  console.log("Usage: node 
github LessWrong2 / Lesswrong2 / packages / lesswrong / lib / events / server.js View on Github external
import { getSetting } from 'meteor/vulcan:lib';
import Intercom from 'intercom-client';

// Initiate Intercom on the server
const intercomToken = getSetting("intercomToken", null);
let intercomClient = null;
if (intercomToken) {
  intercomClient = new Intercom.Client({ token: intercomToken });
}

import './callbacks_async.js';


export default intercomClient;
github VulcanJS / Vulcan / packages / vulcan-events-intercom / lib / server / intercom-server.js View on Github external
import { Connectors, getSetting /* addCallback, Utils */ } from 'meteor/vulcan:core';
import {
  // addPageFunction,
  addUserFunction,
  // addInitFunction,
  // addIdentifyFunction,
  addTrackFunction,
} from 'meteor/vulcan:events';
import Users from 'meteor/vulcan:users';

const token = getSetting('intercom.accessToken');

if (!token) {
  throw new Error('Please add your Intercom access token as intercom.accessToken in settings.json');
} else {
  export const intercomClient = new Intercom.Client({ token });

  const getDate = () =>
    new Date()
      .valueOf()
      .toString()
      .substr(0, 10);

  /*

  New User

  */
  // eslint-disable-next-line no-inner-declarations
  async function intercomNewUser({ user }) {
    await intercomClient.users.create({
      email: user.email,
github quanglam2807 / webcatalog / src / routes / api / feedbackApiRouter.js View on Github external
import express from 'express';
import passport from 'passport';
import errors from 'throw.js';
import { Client as IntercomClient } from 'intercom-client';

const feedbackApiRouter = express.Router();

const intercomClient = new IntercomClient({ token: process.env.INTERCOM_ACCESS_TOKEN });

feedbackApiRouter.post('/', passport.authenticate('jwt', { session: false }), (req, res, next) => {
  console.log(req.body);

  if (!req.body) return next(new errors.BadRequest());

  if (!req.body.content) {
    return next(new errors.BadRequest());
  }

  const message = {
    from: {
      type: 'user',
      user_id: req.user.id,
      email: req.user.email,
    },
github reindexio / reindex-api / server / IntercomClient.js View on Github external
function getClient() {
  if (client) {
    return client;
  } else {
    const { appId, appApiKey } = Config.get('Intercom');

    if (appId && appApiKey) {
      client = new Client({ appId, appApiKey });
      return client;
    }
  }
}
github quanglam2807 / webcatalog / src / routes / submit.js View on Github external
import express from 'express';
import errors from 'throw.js';
import { Client as IntercomClient } from 'intercom-client';

import ensureLoggedIn from '../middlewares/ensureLoggedIn';

const submitRouter = express.Router();

const intercomClient = new IntercomClient({ token: process.env.INTERCOM_ACCESS_TOKEN });

submitRouter.get('/', ensureLoggedIn, (req, res) => {
  res.render('submit/index', { title: 'Submit New App' });
});

submitRouter.post('/', ensureLoggedIn, (req, res, next) => {
  if (!req.body) return next(new errors.BadRequest('Request is not valid.'));

  if (!req.body.name || !req.body.url) {
    return next(new errors.BadRequest('Request is not valid.'));
  }

  const message = {
    from: {
      type: 'user',
      user_id: req.user.id,

intercom-client

Official Node bindings to the Intercom API

Apache-2.0
Latest version published 4 months ago

Package Health Score

73 / 100
Full package analysis

Popular intercom-client functions