0.1.1 • Published 9 years ago

intercom-api v0.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

intercom-api Build

Node client for the intercom.io api

intercom-api uses Stallion so it's minimal code, easy to add new methods and promised based

Installation

npm install intercom-api --save

Support Resources

All methods are supported on all the below resources

* https://api.intercom.io/admins
* https://api.intercom.io/companies
* https://api.intercom.io/contacts
* https://api.intercom.io/counts
* https://api.intercom.io/events
* https://api.intercom.io/notes
* https://api.intercom.io/segments
* https://api.intercom.io/tags
* https://api.intercom.io/users

Overview

intercom.io is a simple wrapper around the Intercom.io api so requests and responses follow their documentation

All methods return a ES6 promise.

Creating a client

require Intercom = require('intercom-api');

// You can find these in your app's integrations page under the "API Keys" section
var app_id = 'jbslxytr';
var api_key = '72cdef54ab2f9ecc53cc806a1b6c4ab3d40f14a4';

var intercom = new Intercom(app_id, api_key);

Users

For the complete list of user attributes for the request & response see the User Model

var data =
  user_id: 123,
  email: 'joe.montana@intercom.io',
  name: 'Joe Montana'
};

intercom.createUser(data).then(function(user) {
  // User will be an object
  // {
  //   id:
  //   user_id: 3,
  //   name: "Joe Montana",
  //   ...
  //   updated_at: 1398269574
  // }
});

Companies

Will add more examples soon, but they all follow the same pattern just take a look at the Intercom.io api docs

Todo

  1. Add support for https://api.intercom.io/conversations
  2. Add support for https://api.intercom.io/messages
  3. Add convenience method to get users for a company
  4. Add convenience method to remove a company from user
  5. Add convenience method to add a company to user
  6. Add convenience methods to
  7. Add tag to users & companies (tagUser, tagUsers, tagCompany, tagCompanies)
  8. Remove tag from users & companies
  9. What about adding multiple tags?