zendesk-helper
v2.0.1
Published
***
Downloads
23
Readme
Zendesk Helper Library
Install
To use the package, just do the standard
$ npm install --save zendesk-helper
Startup
- CommonJS
var Zendesk = require('zendesk-helper');
var zendeskHelper = new Zendesk('username', 'apiToken', 'remoteUrl');
- ESM
import Zendesk from 'zendesk-helper';
const zendeskHelper = new Zendesk('username', 'apiToken', 'remoteUrl');
Usage
- GetClient
// It returns zendesk client object
const client = zendeskHelper.GetClient();
- Verify
// authanticates the user
// returns an object of role,active status and verification status
// it returns promise so resolve the promise
const user = await zendeskHelper.Verify();
- CreateUser
// creates a user if not availavle
// it returns the created user
// it takes one argument userObject
// it returns promise so resolve the promise
const user = await zendeskHelper.CreateUser(
{
email:'[email protected]',
firstName:'Rakesh',
middleName:'Kumar', // Optional
lastName:'Mishra',
...
}
);
- GetUsersURL
// it returns the url of users
const usersUrl = zendeskHelper.GetUsersURL();
- GetUserByEmail
// it returns the user of given email
// it returns promise so resolve the promise
const user = await zendeskHelper.GetUserByEmail(email);
- GetUserByZendeskId
// it returns the user of given zendeskId
// it returns promise so resolve the promise
const user = await zendeskHelper.GetUserByZendeskId(zendeskId);
- GetGroupsURL
// it returns the group url
const groupUrl = zendeskHelper.GetGroupsURL();
- GetTicketsURL
// it returns the tickets url
const ticketsUrl = zendeskHelper.GetTicketsURL();
- CreateTicket
// it returns the created ticket
// takes two arguments ticketObject and userObject
// if user exists creates ticket for that user
// if user not exist creates user and ticket for that user as well
// it returns promise so resolve the promise
const ticket = await zendeskHelper.CreateTicket({
ticketObject:{...},
userObject:{...},
});
- GetTicketById
// it return the ticket for given ticketId
// takes to arguments ticketId
// it returns promise so resolve the promise
const ticket = await zendeskHelper.GetTicketById(ticketId)