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

@zervise/zervise-api

v1.0.0

Published

A Promise based Node.js wrapper of Zervise API for easily integrating any node app with Zervise's customer support portal and ticketing system.

Downloads

14

Readme

A Promise based Node.js wrapper of Zervise API for easily integrating any Node app with Zervise's customer support portal and ticketing system.

license npm latest package npm downloads gitlab start minified size install size last commit closed issues open issues

Table of Contents

Zervise

  • Add an efficient ticketing system for free, Free Plan comes with No credit card, upto 5 agents
  • Unlimited Users
  • Unlimited Tickets
  • SLA Management
  • Email Notification
  • Ticket Creation by Web
  • Ticket creation through Chat
  • Real Time Chat with Agent
  • Real Time Ticket Update

Features

  • Integrate your Zervise subdomain with your other app.
  • Add an efficient ticketing system for your customers.
  • View tickets to manage your customer complaints.
  • Authenticate your users in Zervise subdomain with their email.
  • Show the FAQs for your Zervise subdomain in your other apps.

Installing

  • Using npm:
$ npm install @zervise/zervise-api
  • Using yarn:
$ yarn add @zervise/zervise-api

Your Zervise Subdomain

Sign Up in Zervise

For using this package you need a Zervise account and a Zervise subdomain. To create a Free Zervise Account and get your own Zervise subdomain head over to this link 👉 Sign Up in Zervise.

Find your Zervise subdomain

Upon succesfull sign up you should receive one email with your zervise subdomain link in the registered email address.

Example

If your link is https://zervisefree-qee_ro1a8jwr.zervise.com/, then your zervise subdoamin is zervisefree-qee_ro1a8jwr.

Examples

Import to your project

import {
  authenticate,
  createTicket,
  authAndCreate,
  getUserTickets,
  replyAsUser,
  getUserFaqs,
} from 'zervise-integration';

or,

const {
  authenticate,
  createTicket,
  authAndCreate,
  getUserTickets,
  replyAsUser,
  getUserFaqs,
} = require('zervise-integration');

Authenticate and Create Tickets

  • 2 step process
// Step 1: Authenticate user
authenticate('zervisefree-qee_ro1a8jwr', {
  name: 'test-user',
  email: '[email protected]',
  mobile: '+918555198553', // optional
  appName: 'my-app', // optional
})
  .then((data) => {
    console.log(data);

    // Step 2: Create a ticket with the tocken recived
    createTicket(data.token, 'zervisefree-qee_ro1a8jwr', {
      description: 'Issue described by your user',
      priority: 'high', // optional
      tags: ['refund', 'return'], // optional
    }).then((ticketData) => {
      // Ticket created in your Zervise Subdomain
      console.log(ticketData);
    });

    // View the tickets created by the user
    getUserTickets(data.token).then((data) => console.log(data));
  })
  .catch((err) => console.log(err));
  • 1 step process
// Authenticate user and create a ticket in a single step
authAndCreate('zervisefree-qee_ro1a8jwr', {
  name: 'test-user',
  email: '[email protected]',
  mobile: '+918555198553', // optional
  appName: 'my-app', // optional
  description: 'Issue described by your user',
  priority: 'high', // optional
  tags: ['refund', 'return'], // optional
})
  .then((data) => {
    console.log(data);

    // View the tickets created by the user
    getUserTickets(data.token).then((data) => console.log(data));
  })
  .catch((err) => console.log(err));

Reply to a ticket as the user

let token;
authenticate('zervisefree-qee_ro1a8jwr', {
  name: 'test-user',
  email: '[email protected]',
  mobile: '+918555198553', // optional
  appName: 'my-app', // optional
})
  .then((data) => {
    console.log(data);

    // save the token
    token = data.token;

    // Get the tickets created by the user
    getUserTickets(data.token)
      .then((tickets) => {
        console.log(tickets);
        /* tickets array
            [
              {
                "_id": "612cd35301992244bb806ae6",
                "ticketDescription": "tciekt description text.",
                "ticketHeading": "ticket heading text.",
                "clientId": "6318f23840609d218f30019d",
                "createdPersonId": "61609dfc01992114bb806adf",
                "dateCreated": "2021-08-18T09:30:59.906Z",
                ...
              },
              {...},
              ...
            ]
            */

        // Replying to the 1st ticket
        // You can reply to any of the tickets
        // using its "_id".
        replyAsUser(token, tickets[0]._id, {
          message: 'Reply message text',
        })
          .then((ticket) => {
            // Reply successfull
            // Ticket object is returned
            console.log(ticket);
          })
          .catch((err) => console.log(err));
      })
      .catch((err) => console.log(err));
  })
  .catch((err) => console.log(err));

Get the FAQ articles of your company for users

getUserFaqs('zervisefree-qee_ro1a8jwr').then((articles) => {
  // FAQ articles
  console.log(articles);
});

Zervise API

authenticate(subdomain, {name, email[, mobile, appName]})

For authenticating user with your subdomain.

const data = await authenticate('zervisefree-qee_ro1a8jwr', {
  name: 'test-user',
  email: '[email protected]',
  mobile: '+918555198553', // optional
  appName: 'my-app', // optional
});

/*
data = {
        person: <object with user details>,
        token: <authentication token for the user>,
        subdomain: <your subdomain URL>
      }
*/

createTicket(token, subdomain, {description[, priority, tags]})

For creating a ticket.

const ticket = await createTicket(
  data.token, // token received from authenticate() method
  'zervisefree-qee_ro1a8jwr',
  {
    description: 'Issue described by your user',
    priority: 'high', // optional
    tags: ['refund', 'return'], // optional
  }
);

/*
ticket = <ticket object>
*/

authAndCreate(subdomain, {name, email[, mobile, appName, description, priority, tags]})

For authenticating user with your subdomain and create a ticket in a single step.

const data = await authAndCreate('zervisefree-qee_ro1a8jwr', {
  name: 'test-user',
  email: '[email protected]',
  mobile: '+918555198553', // optional
  appName: 'my-app', // optional
  description: 'Issue described by your user',
  priority: 'high', // optional
  tags: ['refund', 'return'], // optional
});

/*
data = {
        person: <object with user details>,
        token: <authentication token for the user>,
        ticket: <ticket object>
        subdomain: <your subdomain URL>
      }
*/

getUserTickets(token)

For getting all the tickets of a specific user with authentication token.

const tickets = await getUserTickets(data.token);
// "data.token" is the token received from authenticate() or authAndCreate() method.

/*
// array of tickets
tickets = [
  <ticket object>,
  <ticket object>,
  <ticket object>,
  ...
]
*/

replyAsUser(token, ticketId, {message})

For replying to a ticket as an user with the authentication token.

// ticketId is the "_id" field inside a ticket object.
const ticket = await replyAsUser(data.token, ticket._id, {
  message: 'Reply message text',
});
// "data.token" is the token received from authenticate() or authAndCreate() method.

/*
ticket = <ticket object>
*/

getUserFaqs(subdomain)

For getting the FAQs of your company.

const faqs = await getUserFaqs('zervisefree-qee_ro1a8jwr');

/*
// array of FAQ articles
faqs = [
  <FAQ object>,
  <FAQ object>,
  <FAQ object>,
  ...
]
*/

Resources

Issues

If you encounter any issue while using the package please report it here 👉 Zervise API > Issues

License

MIT License