npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

helpscout-v2

v0.0.2

Published

Node.js package for integrating with HelpScout API V2

Downloads

5

Readme

Unofficial HelpScout SDK for HelpScout API v2

This is my very first SDK integrated with HelpScout API, please feel free to use. If you have questions or issues, please feel free to open a new issue on this repository.

NPM

npm i --save helpscout-v2

How to use

const helpscout = require('helpscout-v2')(options);

Parameters


All parameters for options are listed by below.

| Parameter | Description | |-------------|-------------| | client_id | A hash string which is generated by HelpScout (App ID) | | client_secret | A hash string which is generated by HelpScout (App Secret) | | access_token | A hash string which can be got it by authentication function. |

Token


  • Authentication: helpscout.token.authenticate()
// import `helpscout-v2` and pass your `options` value.
const helpscout = require('helpscout-v2')(options);
try {
  const token = await helpscout.token.authenticate();
  // Get a result
  console.log(token);
}catch(ex) {
  // Catch an error
  console.log(ex);
};
  • Refresh Access Token: helpscout.token.refreshAccessToken([options])

| Parameter | Description | |-------------|-------------| | refresh_token | A hash string which can be got it by authentication function. |

// import `helpscout-v2` and pass your `options` value.
const helpscout = require('helpscout-v2')(options);
try {
  const refresh_token = "..................";
  const token = await helpscout.token.refreshAccessToken({  refresh_token });
  // Get a result
  console.log(token);
}catch(ex) {
  // Catch an error
  console.log(ex);
};

Mailbox


  • List mailboxes: helpscout.mailbox.get([id [,options]])

id | Parameter | Description | |-------------|-------------| | id (optional) | A mailbox id |

options | Parameter | Description | |-------------|-------------| | access_token (optional) | (Override) A hash string which can be got it by authentication function. |

// import `helpscout-v2` and pass your `options` value.
const helpscout = require('helpscout-v2')(options);
try {
  // List mailboxes
  const mailboxes = await helpscout.mailbox.get();
  // Get a result
  console.log(mailboxes);
}catch(ex) {
  // Catch an error
  console.log(ex);
};
// import `helpscout-v2` and pass your `options` value.
const helpscout = require('helpscout-v2')(options);
try {
  // Get information from mailbox id `1`
  const mailbox = await helpscout.mailbox.get(1);
  // Get a result
  console.log(mailbox);
}catch(ex) {
  // Catch an error
  console.log(ex);
};
  • Get mailbox folders: helpscout.mailbox.getFolders(id [,options])

id | Parameter | Description | |-------------|-------------| | id | A mailbox id |

options | Parameter | Description | |-------------|-------------| | access_token (optional) | (Override) A hash string which can be got it by authentication function. |

// import `helpscout-v2` and pass your `options` value.
const helpscout = require('helpscout-v2')(options);
try {
  // List mailboxes
  const mailboxes = await helpscout.mailbox.getFolders(1);
  // Get a result
  console.log(mailboxes);
}catch(ex) {
  // Catch an error
  console.log(ex);
};

Conversation

  • Get list of conversations: helpscout.conversation.list([options]) Please refer to HelpScout document on how to use those parameters. (https://developer.helpscout.com/mailbox-api/endpoints/conversations/list/)

options

| Parameter | Description | |-------------|-------------| | mailbox | Filters conversations from a specific mailbox id. Use comma separated values for more mailboxes: ?mailbox=123,456 | | folder | Filters conversations from a specific folder id: ?folder=993 | | status | Filter conversation by status (defaults to active): activeopenclosedpendingspamall | | tag | Filter conversation by tags. Use comma separated values for more tags that: ?tag=red,blue | | assigned_to | Filters conversations by assignee id: ?assigned_to=1771 | | modifiedSince | Filters conversations modified after this timestamp - ISO 8061 date time | | number | Looks up conversation by conversation number | | sortField | Sorts the result by specified field: createdAtcustomerEmailcustomerNamemailboxidmodifiedAtnumberscorestatussubject | | sortOrder | Sort order, either desc or asc, default is desc | | query | Advanced search query. If you use other filtering request parameters, they will be combined with AND operator.For example ?mailbox=567&query=tag:fire effectively means mailbox=567 AND tag=fire. | | page | Page number |

// import `helpscout-v2` and pass your `options` value.
const helpscout = require('helpscout-v2')(options);
try {
  // List conversations
  const conversations = await helpscout.conversation.list();
  // Get a result
  console.log(conversations);
}catch(ex) {
  // Catch an error
  console.log(ex);
};
  • Get a conversation: helpscout.conversation.get(id, [options]) Please refer to HelpScout document on how to use those parameters. (https://developer.helpscout.com/mailbox-api/endpoints/conversations/get/)

id | Parameter | Description | |-------------|-------------| | id (optional) | A conversation id |

options | Parameter | Description | |-------------|-------------| | access_token (optional) | (Override) A hash string which can be got it by authentication function. |

// import `helpscout-v2` and pass your `options` value.
const helpscout = require('helpscout-v2')(options);
try {
  // Get a conversation
  const conversation = await helpscout.conversation.get(123);
  // Get a result
  console.log(conversation);
}catch(ex) {
  // Catch an error
  console.log(ex);
};