New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

intercom-client

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intercom-client - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

dist/conversation.js

41

dist/client.js

@@ -27,2 +27,6 @@ 'use strict';

var _message = require('./message');
var _conversation = require('./conversation');
var unirest = require('unirest');

@@ -56,2 +60,4 @@

this.segments = new _segment.Segment(this);
this.messages = new _message.Message(this);
this.conversations = new _conversation.Conversation(this);
}

@@ -62,3 +68,3 @@

value: function ping(f) {
unirest.get('https://api.intercom.io/admins').auth(this.appId, this.appApiKey).type('json').header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.4.1').end(function (r) {
unirest.get('https://api.intercom.io/admins').auth(this.appId, this.appApiKey).type('json').header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.5.0').end(function (r) {
return f(r.status);

@@ -68,7 +74,7 @@ });

}, {
key: 'post',
value: function post(endpoint, data, f) {
key: 'put',
value: function put(endpoint, data, f) {
var _this = this;
unirest.post('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.4.1').end(function (r) {
unirest.put('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.5.0').end(function (r) {
return _this.callback(f, r);

@@ -78,7 +84,7 @@ });

}, {
key: 'get',
value: function get(endpoint, data, f) {
key: 'post',
value: function post(endpoint, data, f) {
var _this2 = this;
unirest.get('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.4.1').end(function (r) {
unirest.post('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.5.0').end(function (r) {
return _this2.callback(f, r);

@@ -88,7 +94,7 @@ });

}, {
key: 'nextPage',
value: function nextPage(paginationObject, f) {
key: 'get',
value: function get(endpoint, data, f) {
var _this3 = this;
unirest.get(paginationObject.next).auth(this.appId, this.appApiKey).type('json').header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.4.1').end(function (r) {
unirest.get('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.5.0').end(function (r) {
return _this3.callback(f, r);

@@ -98,7 +104,7 @@ });

}, {
key: 'delete',
value: function _delete(endpoint, data, f) {
key: 'nextPage',
value: function nextPage(paginationObject, f) {
var _this4 = this;
unirest['delete']('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.4.1').end(function (r) {
unirest.get(paginationObject.next).auth(this.appId, this.appApiKey).type('json').header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.5.0').end(function (r) {
return _this4.callback(f, r);

@@ -108,2 +114,11 @@ });

}, {
key: 'delete',
value: function _delete(endpoint, data, f) {
var _this5 = this;
unirest['delete']('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/0.5.0').end(function (r) {
return _this5.callback(f, r);
});
}
}, {
key: 'callback',

@@ -110,0 +125,0 @@ value: function callback(f, data) {

{
"name": "intercom-client",
"version": "0.4.1",
"version": "0.5.0",
"description": "Official Node bindings to the Intercom API",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/intercom/intercom-node",

@@ -278,2 +278,68 @@ # intercom-node

## Messages
```node
// Admin initiated messages:
// Sending an email to a User
var message = {
message_type: "email",
subject: "Hey",
body: "Ponies, cute small horses or something more sinister?",
template: "plain",
from: {
"type": "admin",
"id": "21599"
},
to: {
"type": "user",
"id": "55c1ce1def857c31f80001af"
}
}
client.messages.create(message, callback);
```
```node
// Creating a user-initiated message:
var message = {
"from": {
"type": "user",
"id": "55c1ce1def857c31f80001af"
},
"body": "Howdy"
}
client.messages.create(message, callback);
```
Listing conversations ([documentation](https://doc.intercom.io/api/#list-conversations)):
```node
client.conversations.list({ type: 'admin', admin_id: 21599 }, callback);
```
```node
// Fetching a conversation
client.conversations.find({ id: '1062682196' }, callback);
```
```node
// Replying to a conversation
var reply = {
id: '1039067180',
intercom_user_id: '55b26822ce97179e52001334',
body: 'Some reply :)',
type: 'user',
message_type: 'comment'
};
client.conversations.reply(reply, callback);
```
```node
// Marking a conversation as read
client.conversations.markAsRead({ id: '1039067180' }, callback);
```
## Pagination

@@ -280,0 +346,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc