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

freshsales-api

v1.0.1

Published

FreshSales Api for NodeJS

Downloads

9

Readme

nodejs-freshsales

Known Vulnerabilities

FreshSales api wrapper for the freshsales api. Has Promise handling. See https://www.freshsales.io/api/

var FreshSales = require('freshsales-api')

//Using API-KEY
var authentication = {
    api_key: "FRESH SALES API KEY"
};

//Using email and password
var authentication = {
    email: "FRESH SALES Email",
    password: "FRESH SALES PASSWORD"
};

/**
 * Initiate FreshSales Constructor, to setup the API
 * authentication - THe authentication object
 * domain - Your FreshSales URL : Syntax = https://subdomain.freshsales.io
 *
 * Throws the following possible errors:
 * 1. If domain is missing: "Domain name required for FreshSales API. Syntax: https://domain.freshsales.io"
 * 2. If authentication object does not contain API key or UserCredentials - "API Key or UserCredentials not provided"
 */
var freshsales = new FreshSales(domain, authentication);

//Promise style
var options = {
    endpoint: 'API Endpoint',
    payload: payload
};
var method = "POST|GET|PUT|DELETE"
freshsales.request(method, options).then(function (result) {
  ...
}).catch(function (err) {
  ...
});

Installation

NPM package is available for the repository. You can either install it from the NPM package directory or via the git url as:

npm install freshsales-api

        [OR]

npm install GIT_REMOTE_URL

Usage

For information on the possible endpoints, refer to the FreshSales Api documentation: https://www.freshsales.io/api

Steps

Initialization

var FreshSales = require('freshsales-api')

API Setup

/**
 * Initiate FreshSales Constructor, to setup the API
 * authentication - THe authentication object
 * domain - Your FreshSales URL : Syntax = https://subdomain.freshsales.io
 *
 * Throws the following possible errors:
 * 1. If domain is missing: "Domain name required for FreshSales API. Syntax: https://domain.freshsales.io"
 * 2. If authentication object does not contain API key or UserCredentials - "API Key or UserCredentials not provided"
 */
var freshsales = new FreshSales(domain, authentication);

Authentication Object can be any one of the following Using API-KEY

var authentication = {
    api_key: "FRESH SALES API KEY"
};

Using email and password

var authentication = {
    email: "FRESH SALES Email",
    password: "FRESH SALES PASSWORD"
};

Standard Calls

var options = {
    endpoint: 'API Endpoint',
    payload: 'Th object containing payload to be sent if a POST or PUT request is made',
    query: 'The object containing key-value pair of parameters to be attached to the request url'
};
var method = "POST|GET|PUT|DELETE";

//Response would be a json response at all times
freshsales.request(method, options).then(function (result) {
  ...
}).catch(function (err) {
  ...
});

Future Updates

Support for the following will be added over time:

  1. Callback Support for the available methods
  2. Support for PathParams as a separate key in the available method
  3. Helper methods - Convenience methods such as FreshSales.get, FreshSales.put, FreshSales.push, FreshSales.delete

Suggestion and Bugs and Problems and Fixes in the Source Code are welcome.