intercom-client
Advanced tools
Comparing version 2.8.1 to 2.8.2
@@ -23,2 +23,7 @@ 'use strict'; | ||
} | ||
}, { | ||
key: 'me', | ||
value: function me(f) { | ||
return this.client.get('/me', {}, f); | ||
} | ||
}]); | ||
@@ -25,0 +30,0 @@ |
@@ -35,2 +35,6 @@ 'use strict'; | ||
var _visitor = require('./visitor'); | ||
var _visitor2 = _interopRequireDefault(_visitor); | ||
var _counts = require('./counts'); | ||
@@ -96,2 +100,3 @@ | ||
this.leads = new _contact2.default(this); | ||
this.visitors = new _visitor2.default(this); | ||
this.counts = new _counts2.default(this); | ||
@@ -98,0 +103,0 @@ this.admins = new _admin2.default(this); |
@@ -48,3 +48,7 @@ 'use strict'; | ||
value: function find(params, f) { | ||
return this.client.get('/contacts/' + params.id, {}, f); | ||
if (params.id) { | ||
return this.client.get('/contacts/' + params.id, {}, f); | ||
} else if (params.user_id) { | ||
return this.client.get('/contacts', { user_id: params.user_id }, f); | ||
} | ||
} | ||
@@ -51,0 +55,0 @@ }, { |
@@ -30,2 +30,7 @@ 'use strict'; | ||
}, { | ||
key: 'listBy', | ||
value: function listBy(params, f) { | ||
return this.client.get('/events', params, f); | ||
} | ||
}, { | ||
key: 'bulk', | ||
@@ -32,0 +37,0 @@ value: function bulk(params, f) { |
@@ -30,2 +30,7 @@ 'use strict'; | ||
}, { | ||
key: 'update', | ||
value: function update(data, f) { | ||
return this.create(data, f); | ||
} | ||
}, { | ||
key: 'list', | ||
@@ -32,0 +37,0 @@ value: function list(f) { |
{ | ||
"name": "intercom-client", | ||
"version": "2.8.1", | ||
"version": "2.8.2", | ||
"description": "Official Node bindings to the Intercom API", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/intercom/intercom-node", |
@@ -14,3 +14,3 @@ # intercom-node | ||
(Note, this is in Beta and is for testing purposes only, it should not be used in production) | ||
```bash | ||
@@ -92,8 +92,3 @@ npm install intercom-client | ||
```node | ||
// Create/update a user | ||
client.users.create({ email: 'jayne@serenity.io' }, function (r) { | ||
console.log(r); | ||
}); | ||
// Create/update a user with custom attributes | ||
// Create a user | ||
client.users.create({ | ||
@@ -105,2 +100,10 @@ email: 'jayne@serenity.io', | ||
}, callback); | ||
// Update a user | ||
client.users.update({ | ||
email: 'jayne@serenity.io', | ||
custom_attributes: { | ||
foo: 'bar' | ||
} | ||
}, callback); | ||
``` | ||
@@ -183,2 +186,40 @@ | ||
## Visitors | ||
```node | ||
// Update a visitor by id | ||
client.visitors.update({ id: '5435345', email: 'wash@serenity.io' }, callback); | ||
``` | ||
```node | ||
// Find visitor by id or user_id | ||
client.visitors.find({ id: '5342423' }, callback); | ||
client.visitors.find({ user_id: '5b868511-ca3b-4eac-8d26-cfd82a83ac76' }, callback); | ||
``` | ||
```node | ||
// Delete visitor by id | ||
client.visitors.delete({ id: '5342423' }, callback); | ||
``` | ||
```node | ||
// Convert visitors into Users | ||
var conversion = { | ||
visitor: { user_id: '1234-5678-9876' }, | ||
user: { email: 'mal@serenity.io' }, | ||
type: "user" | ||
}; | ||
client.visitors.convert(conversion, callback); | ||
``` | ||
```node | ||
// Convert visitors into Lead | ||
var conversion = { | ||
visitor: { user_id: '1234-5678-9876' }, | ||
type: "lead" | ||
}; | ||
client.visitors.convert(conversion, callback); | ||
``` | ||
## Companies | ||
@@ -229,2 +270,10 @@ | ||
```node | ||
// List events by user | ||
client.events.listBy({ | ||
type: 'user', | ||
user_id: 'bar' | ||
}, callback); | ||
``` | ||
## Counts | ||
@@ -257,2 +306,7 @@ | ||
```node | ||
// Find current admin (only works with OAuth tokens) | ||
client.admins.me(callback); | ||
``` | ||
## Tags | ||
@@ -259,0 +313,0 @@ |
42016
18
708
510