Giter Club home page Giter Club logo

node-freshdesk-api's Introduction

Node wrapper for Freshdesk v2 API

All Contributors

Build Status codecov

Install

npm install --save freshdesk-api

Also, you could use version 1 of API, provided by Kumar Harsh @kumarharsh, but this version is obsolete, and marked as deprecated:

npm install freshdesk-api@APIv1

Usage

var Freshdesk = require("freshdesk-api");
var freshdesk = new Freshdesk("https://yourdomain.freshdesk.com", "yourApiKey");

Or, with promises:

var Freshdesk = require("freshdesk-api");
var Promise = require("bluebird");
var asyncFreshdesk = Promise.promisifyAll(
	new Freshdesk("https://yourdomain.freshdesk.com", "yourApiKey")
);

// see usage examples

bluebird is not a dependency of this package, install it separately: npm install bluebird

Examples

Create a new ticket

freshdesk.createTicket(
	{
		name: "test ticket",
		email: "[email protected]",
		subject: "test sub",
		description: "test description",
		status: 2,
		priority: 1,
	},
	function (err, data) {
		console.log(err || data);
	}
);

Update a ticket

freshdesk.updateTicket(
	21,
	{
		description: "updated description",
		status: 2,
		priority: 1,
	},
	function (err, data, extra) {
		console.log(err || data);
	}
);

Get a ticket

freshdesk.getTicket(21, function (err, data, extra) {
	console.log(err || data);
});

Delete a ticket

freshdesk.deleteTicket(21, function (err, data, extra) {
	console.log(err || data);
});

Ticket attachments

freshdesk.createTicket(
	{
		description: "test description",
		attachments: [
			fs.createReadStream("/path/to/file1.ext"),
			fs.createReadStream("/path/to/file2.ext"),
		],
	},
	function (err, data) {
		console.log(err || data);
	}
);

Get a ticket PROMISIfied

* for promisified version only

asyncFreshdesk.getTicketAsync(21)
    .then((data, extra) => {
        console.log(data, extra)
    })

    .catch(Freshdesk.FreshdeskError, err => {
        // typed `catch` exists only in bluebird

        console.log('ERROR OCCURED', err)
    })
})

Testing & mocking

Note that node-freshdesk-api is using Undici as an HTTP client, which is not based on Node.js net module. As a result, it is not compatible with popular nock mocking library. When mocking node-freshdesk-api interactions, make sure to use built-in Undici mocking functionality.

Alternatively, you can use tests of node-freshdesk-api itself as an example.

The only exception are forms with attachments (field attachments is set and is an array) - these requests are handled using form-data library, use net module and need to be mocked with nock.

You can also use a mock server (such as Pactum) for completely client-agnostic server mocking.

Use with Webpack

Here is a part of webpack.config:

webpackConfig.node = {
	// ...

	console: true,
	fs: "empty",
	net: "empty",
	tls: "empty",

	// ...
};

A little bit more about webpack here

Callback

Every SDK method receives a callback parameter. It is a function, which will be called on Freshdesk response received.

Callback called with following arguments:

  • err - Error instance (if occured) or null
  • data - object. Freshdesk response, an object, parsed from JSON
  • extra - additional data, gathered from response. For example, information about paging

extra parameter

extra is an object with following fields:

  • pageIsLast - indicates, that the response is generated from the last page, and there is no sense to play with page and per_page parameters. This parameter is useful for listXXX methods, called with pagination
  • requestId - value of x-request-id header from API response

Extended/debugging output

To enable debug info, run your program with environment flags

  • on linux
    $ DEBUG=freshdesk-api nodejs NAME-OF-YOUR-SCRIPT.js

Functions and Responses

Tickets

  • createTicket(ticket, callback) - Create a new ticket, list of parameters
  • getTicket(id, callback) - Get a ticket by its id
  • updateTicket(id, ticket, callback) - Update a ticket by its id, list of parameters
  • deleteTicket(id, callback) - Delete a ticket by its id
  • restoreTicket(id, callback) - Restore a ticket by its id
  • listAllTickets(filter, callback) - List All Tickets, check list of filters
  • filterTickets(query, page, callback) - Filter tickets, based on ticket fields, read more
  • listAllTicketFields(callback) - List All Ticket Fields
  • listAllConversations(id, callback) - List All Conversations of a Ticket by its id
  • listAllTicketTimeEntries(id, callback) - List All Time Entries of a Ticket by its id
  • listAllSatisfactionRatings - NOT IMPLEMENTED http://developers.freshdesk.com/api/#view_ticket_satisfaction_ratings

Conversations

  • createReply(id, reply, callback) - Create a Reply for a ticket by its id, list of parameters
  • createNote(id, note, callback) - Create a Note for a ticket by its id, list of parameters
  • updateConversation(id, conversation, callback) - Update a conversation by its id, list of parameters
  • deleteConversation(id, callback) - Delete a conversation by its id

Contacts

  • createContact(contact, callback) - Create a new contact, list of parameters
  • getContact(id, callback) - Get a contact by its id
  • updateContact(id, contact, callback) - Update a contact by its id, list of parameters
  • deleteContact(id, callback) - Delete a contact by its id
  • listAllContacts(filter, callback) - List All Contact, check list of filters
  • listAllContactFields(callback) - List All Contact Fields
  • makeAgent(id, callback) - Make a contact an Agent, read more
  • filterContacts(query, callback) - Filter contacts (beta), based on contact fields, read more

Agents

  • getAgent(id, callback) - Get agent by ID read more
  • listAllAgents(params, callback) - List all agents read more
  • updateAgent(id, data, callback) - Update an agent by ID read more
  • deleteAgent(id, callback) - Delete an agent by ID read more
  • currentAgent(callback) - Currently Authenticated Agentread more

Roles

  • getRole(id, callback) - View a Role
  • listAllRoles(callback) - List All Roles

Groups

Not implemented: http://developers.freshdesk.com/api/#groups

Companies

  • createCompany(data, callback) - Create a new company record using parameters
  • getCompany(id, callback) - Get company by ID; read more
  • searchCompany(params, callback) - Get company by name; read more
  • listAllCompanies(params, callback) - List all companies; parameters
  • updateCompany(id, data, callback) - Update a company by ID; parameters
  • deleteCompany(id, callback) - Delete a company by ID, read more
  • filterCompanies(query, callback) - Filter companies (beta), based on company fields, read more
  • listAllCompanyFields(callback) - List All Company Fields

Discussions

Not implemented: http://developers.freshdesk.com/api/#discussions

Solutions

  • createSolutionCategory(data, cb) - Create a Solution Category parameters
  • createTranslatedSolutionCategory(id, language_code, data, cb) - Create a translated solution category parameters
  • updateSolutionCategory(id, data, cb) - Update a Solution Category parameters
  • updateTranslatedSolutionCategory(id, language_code, data, cb) - Update a translated solution category parameters
  • getSolutionCategory(id, cb) - View a Solution Category parameters
  • listAllSolutionCategories(cb) - List all Solution Categories parameters
  • deleteSolutionCategory(id, cb) - Delete a Solution Category parameters
  • createSolutionFolder(id, data, cb) - Create a Solution Folder parameters
  • createTranslatedSolutionFolder(id, language_code, data, cb) - Create a translated solution folder parameters
  • updateSolutionFolder(id, data, cb) - Update a Solution Folder parameters
  • updateTranslatedSolutionFolder(id, language_code, data, cb) - Update a translated solution folder parameters
  • getSolutionFolder(id, cb) - View a Solution Folder parameters
  • listAllSolutionCategoryFolders(id, cb) - List all Solution Folders in a Category parameters
  • deleteSolutionFolder(id, cb) - Delete a Solution Folder parameters
  • createSolutionArticle(id, data, cb) - Create a Solution Article parameters
  • createTranslatedSolutionArticle(id, language_code, data, cb) - Create a translated solution article parameters
  • updateSolutionArticle(id, data, cb) - Update a Solution Article parameters
  • updateTranslatedSolutionArticle(id, language_code, data, cb) - Update a translated solution article parameters
  • getSolutionArticle(id, cb) - View a Solution Article parameters
  • listAllSolutionFolderArticles(id, cb) - List all Solution Articles in a Folder parameters
  • deleteSolutionArticle(id, cb) - Delete a Solution Article parameters
  • searchSolutionArticles(term, cb) - Search solution articles parameters

Surveys

Not implemented: http://developers.freshdesk.com/api/#surveys

Satisfaction Ratings

Not implemented: http://developers.freshdesk.com/api/#satisfaction-ratings

Time Entries

  • createTimeEntry(ticketID, data, callback) - Create new ticket read more
  • listAllTimeEntries(params, callback) - Lists all time entries, if no params pass 'null' read more
  • updateTimeEntry(entryID, data, callback) - Update a time entry by ID read more
  • toggleTimer(entryID, callback) - Toggle timer on time entry by ID read more
  • deleteTimeEntry(id, callback) - Deletes a time entry by ID read more

Email Configs

Not implemented: http://developers.freshdesk.com/api/#email-configs

Products

Not implemented: http://developers.freshdesk.com/api/#products

Business Hours

Not implemented: http://developers.freshdesk.com/api/#business-hours

SLA Policies

SLA = service level agreement

Not implemented: http://developers.freshdesk.com/api/#sla-policies

Settings

  • getSettings(callback) - View Helpdesk Settings read more

License

See the LICENSE file for license rights and limitations (MIT).

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Arjun Komath
Arjun Komath

💻 📖 ⚠️
Maksim Koryukov
Maksim Koryukov

💻 📖 ⚠️
DMehaffy
DMehaffy

💻 📖 ⚠️
John Williamson
John Williamson

💻 📖
Wouter van der Neut
Wouter van der Neut

💻 📖 ⚠️
Julián Duque
Julián Duque

💻
Michael Lambert
Michael Lambert

💻 📖 ⚠️
Pongstr
Pongstr

💻
Igor Savin
Igor Savin

💻
jae kaplan
jae kaplan

💻
Kumar Harsh
Kumar Harsh

💻
roniger
roniger

💻 📖 ⚠️
Mohamed Ahmed
Mohamed Ahmed

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

node-freshdesk-api's People

Contributors

allcontributors[bot] avatar andrewlab-lokalise avatar arjunkomath avatar dependabot-preview[bot] avatar dependabot[bot] avatar derrickmehaffy avatar jeffreymele avatar jkap avatar julianduque avatar kibertoad avatar mae776569 avatar maxkoryukov avatar nibynool avatar pongstr avatar velua avatar wvdneut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

node-freshdesk-api's Issues

Create reply with attachment failing: "(TypeError): form.getHeaders is not a function"

Hi,

I am trying to update a ticket with an attachment but it's failing with the below error:

Unhandled Rejection (TypeError): form.getHeaders is not a function

utils.js:159 Uncaught (in promise) TypeError: form.getHeaders is not a function
    at makeRequest (utils.js:159)
    at Freshdesk.createReply (client.js:226)
    at uploadScreenshot (QuickTicket.jsx:211)

The payload is:

    {
      body: ReactDOMServer.renderToString(rDesc),
      from_email: user.email,
      attachments: [
        sStream
      ],
    };

I followed the instructions on https://www.npmjs.com/package/freshdesk-api to attach a file.
Am I missing something?

cb is not a function

When using listAllConversations method of module. following error is returned.

TypeError: cb is not a function
    at Request._callback (/Users/manish/Remitr/projects/remitr-common/freshdesk/node_modules/node-freshdesk-api/lib/utils.js:63:11)
    at Request.self.callback (/Users/manish/Remitr/projects/remitr-common/freshdesk/node_modules/request/request.js:188:22)
    at emitTwo (events.js:106:13)
```.


On further debugging i found that there is a small error in lib/client.js

```js
listAllConversations(id, cb) {
		makeRequest('GET', this._auth, `${this.baseUrl}/api/v2/tickets/${id}/conversations`, null, cb)
	},

callback cb is passed as 5th parameter instead of 6th.

listAllConversations(id, cb) {
		makeRequest('GET', this._auth, `${this.baseUrl}/api/v2/tickets/${id}/conversations`, null, null, cb)
	},

Please update the repo accordingly

Update ticket attachments

Good morning,

I have an issue with updating attachments of a ticket in the freshdesk-api V2.

Current behavior

When I try to update the attachment, I get this error
[ { field: 'attachments',
message: 'It should contain elements of type valid file format only',
code: 'datatype_mismatch' } ]

Expected behavior

The attachments field is supposed to be an array of objects so I provided that. My code is in the attached file below.

Code

update.pdf

Details

{freshdesk-api: 2.5.0'
npm: '5.6.0',
ares: '1.14.0',
cldr: '33.0',
http_parser: '2.8.0',
icu: '61.1',
modules: '64',
napi: '3',
nghttp2: '1.29.0',
node: '10.1.0',
openssl: '1.1.0h',
tz: '2018c',
unicode: '10.0',
uv: '1.20.2',
v8: '6.6.346.27-node.6',
zlib: '1.2.11' }

Thank you.

Issue about createReply

##npm version
freshdesk-api V2

Current behavior

I try to create fresh desk reply with the api with this config:

freshdesk.createReply(123, {
    body: `Testing at ${new Date()}`,
    attachments: [
      fs.createReadStream('xxx.xlsx'),
      fs.createReadStream('sample.json')
    ],
    cc_emails: ["[email protected]"], 
    // bcc_emails: ["xxxx@xxx"]
  }, function (err, data) {
      console.log(err || data)
  })

However its returning error message:

Error: form-data: Arrays are not supported.
    at FormData.append (/Users/yu/Desktop/test/node_modules/request/node_modules/form-data/lib/form_data.js:66:17)
    at makeRequest (/Users/yu/Desktop/test/node_modules/freshdesk-api/lib/utils.js:200:9)
    at Freshdesk.createReply (/Users/yu/Desktop/test/node_modules/freshdesk-api/lib/client.js:155:3)
    at main (/Users/yu/Desktop/test/index.js:75:13)
    at Object.<anonymous> (/Users/yu/Desktop/test/index.js:87:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

just check the problem on cc_emmails and bcc_emails
For the API Doc, bcc_emails and cc_emails allow to use
how can I change my api setting?

BTW, I find it is a working setting when I use unirest

// unirest.post(URL)
 //   .headers(headers)
 //   .field('body', `Testing at ${new Date()}`)
 //   .field('cc_emails[]', "[email protected]")
 //   .field('bcc_emails[]', "[email protected]")
 //   .attach('attachments[]', fs.createReadStream('xxx.xlsx'))
 //   .attach('attachments[]', fs.createReadStream('sample.json'))
 //   .end(function(response){ console.log(response.req.res.body) })

Thanks!

Build failed for NodeJS 4x on Travis

Another one NPM-related bug.

Will be automatically solved 1 May - we will drop NodeJS 4x support (in accordance with NodeJS LTS schedule).

Just don't forget to rollback changes in .travis.yml

Bring back all tickets

Hi,

There isnt any documentation in regards to this node package as to how you bring back all tickets through the "extra" parameter e.g. freshdesk.listAllTickets((err,data,extra){ console.log(extra) } <

this brings back an object pageIsLast = true,

How can play around with extras because its only bringing back 20 tickets when there are over 100...

promisifyAll example is broken

const freshdesk = promisifyAll(
  new Freshdesk('https://aboutsnack.freshdesk.com', argv.freshdeskApiKey),
);

await freshdesk.createTicket({
  description: 'test description',
  email: '[email protected]',
  name: 'test ticket',
  priority: 1,
  status: 2,
  subject: 'test sub',
});

gives error:

/Users/gajus/Documents/dev/snack/snack-api/node_modules/freshdesk-api/lib/utils.js:112
			return cb(null, data, extra)
			       ^

TypeError: cb is not a function
    at Request._callback (/Users/gajus/Documents/dev/snack/snack-api/node_modules/freshdesk-api/lib/utils.js:112:11)
    at Request.self.callback (/Users/gajus/Documents/dev/snack/snack-api/node_modules/request/request.js:185:22)

How to get x-request-id.

  • freshdesk-api V1 (obsolete)

I want to console the x-request-id from the response header.Please help me on how to get that particular header using this api.

Is the repo alive?

Hello! Thanks for this package;)

I would like to use it for my tiny project, but I need Companies stuff. I have already added all required functions to my local copy of your package, but I could send you a pull request (and we will have a better version of the package)

Are there a chance to update the package on the NPM?

utilize JSDoc

This will make README.md shorter and will help us to keep docs updated.

  • Generate documentation
  • autopublish docs
  • add namespaces for documentation (there is a mess)
  • add CompanyResponse, TimeEntryResponse to the html, currently they are excluded (it is a bug)

npm WARN deprecated [email protected]: request has been deprecated

  • freshdesk-api V2
  • freshdesk-api V1 (obsolete)

Current behavior

The package is working just fine, but I think it would be good to update some npm dependencies.

Could be possible to replace request package, which is deprecated, to another one like got, for example?

Expected behavior

Having a new http request package that is not deprecated

More details

provide the output of npm version in the root of your package

{ 'freshdesk-api': '2.12.0',
  npm: '6.14.11',
}

[Question] how to get all tickets using listAllTickets

I tried to use docs to figure out how to get all tickets from API, but it's just giving me the first 30 tickets; I can see in the extra object there are more pages but don't know how to get those.
Could you please show me an example of that use case?

Thanks

PROPOSAL: publish on NPM from TRAVIS CI

It is not a difficult task, to set up an autopublish:

  1. Build package on Travis CI
  • build
  • lint
  • test
  1. If it is a tag - deploy package to NPM (only if there are no errors on test- and lint- steps). Version for the new NPM package will be taken from name of the tag

Typescript build error

Current behavior

When you build a project with typescript 4, you get a long list of errors like this:

Error: node_modules/freshdesk-api/dist/client.d.ts(48,38): error TS2694: Namespace 'Freshdesk' has no exported member 'TicketsFilter'.
Error: node_modules/freshdesk-api/dist/client.d.ts(48,67): error TS2694: Namespace 'Freshdesk' has no exported member 'requestCallback'.
Error: node_modules/freshdesk-api/dist/client.d.ts(48,93): error TS2694: Namespace 'Freshdesk' has no exported member 'Tickets'.
Error: node_modules/freshdesk-api/dist/client.d.ts(92,49): error TS2694: Namespace 'Freshdesk' has no exported member 'requestCallback'.
Error: node_modules/freshdesk-api/dist/client.d.ts(92,75): error TS2694: Namespace 'Freshdesk' has no exported member 'ContactViewData'.
Error: node_modules/freshdesk-api/dist/client.d.ts(164,40): error TS2694: Namespace 'Freshdesk' has no exported member 'requestCallback'.
Error: node_modules/freshdesk-api/dist/client.d.ts(164,66): error TS2694: Namespace 'Freshdesk' has no exported member 'AgentResponse'.
Error: node_modules/freshdesk-api/dist/client.d.ts(176,37): error TS2694: Namespace 'Freshdesk' has no exported member 'AgentFilter'.
Error: node_modules/freshdesk-api/dist/client.d.ts(176,64): error TS2694: Namespace 'Freshdesk' has no exported member 'requestCallback'.
Error: node_modules/freshdesk-api/dist/client.d.ts(176,90): error TS2694: Namespace 'Freshdesk' has no exported member 'AgentResponse'.
Error: node_modules/freshdesk-api/dist/client.d.ts(189,45): error TS2694: Namespace 'Freshdesk' has no exported member 'AgentData'.

Implement pagination for listAllConversations

Feature Request

Current behavior

Right now, a user passes an id, and the API returns by default 30 conversations. However, there is no way to get more conversations in a paginated manner

Expected behavior

should be similar to listAllTickets

More details

tested we can add per_page and page fields as parameters for the conversation endpoint
GET request to https://domain.freshdesk.com/api/v2/tickets/{ticket_id}/conversations?per_page=1&page=1
returns a link parameter in header

what is difference between freshdesk-api and node-freshdesk-api

what is the difference?

An application which is in production for the past three year built using node-freshdesk-api,now we are facing some issue on freshdesk side so to fix that particular issue we need x-request-id (set by freshdesk server) .Is there any hack to console that x-request-id in that production app itself or we need to migrate to freshdesk-api by doing so what are the changes we have to make please explain.

Can you add feature?

If migration is the only way to fix that issue,Can you expose that x-request-id response header as a feature.

Cant attach files to Create Ticket ***

Current behavior

I´m trying to attach file to a new ticket creation using the below sintax:

freshdesk.createTicket(
{
description: "test description",
attachments: [
fs.createReadStream("/path/to/file1.ext"),
fs.createReadStream("/path/to/file2.ext"),
],
},
function (err, data) {
console.log(err || data);
}
);

And I´m getting the following error message:

(node:15224) UnhandledPromiseRejectionWarning: TypeError: source.on is not a function
at Function.DelayedStream.create (/path/to\node_modules\delayed-stream\lib\delayed_stream.js:33:10)
at FormData.CombinedStream.append (/path/to\node_modules\combined-stream\lib\combined_stream.js:45:37)
at FormData.append (/path/to\node_modules\form-data\lib\form_data.js:75:3)
at makeRequest (/path/to\node_modules\freshdesk-api\lib\utils.js:155:11)
at Freshdesk.createTicket (/path/to\node_modules\freshdesk-api\lib\client.js:147:3)
at createProviderTicket (/path/to\routes\provider.js:8701:13)
at Layer.handle [as handle_request] (/path/to\node_modules\express\lib\router\layer.js:95:5)
at next (/path/to\node_modules\express\lib\router\route.js:137:13)
at Immediate. (/path/to\node_modules\multer\lib\make-middleware.js:53:37)
at processImmediate (internal/timers.js:458:21)
(node:15224) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:15224) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected behavior

It should include de file as attachment as per documentation.

More details

File is being uploaded.
This is how my code is: (ticket creation without attachment is workinh fine)

var TicketObj = {}
TicketObj.type = "Question";
TicketObj.name = name.replace(/[|&;$#%"<>()+,]/g, "");
TicketObj.email = email.replace(/[|&;$#%"<>()+,]/g, "");
TicketObj.subject = subject.replace(/[|&;$#%"<>()+,]/g, "");
TicketObj.description = description.replace(/[|&;$#%"<>()+,]/g, "");
TicketObj.status = 2; //(open)
TicketObj.source = 2; //(portal)
TicketObj.priority = parseInt(priority ? priority : 1); //(low)
TicketObj.custom_fields = {
cf_origin:"provider",
cf_instance:ProviderUserId
}

var src = req.files.attachedFile[0].destination+"/"+req.files.attachedFile[0].filename;
var attachment = fs.createReadStream(src);
TicketObj.attachments = [attachment]

	// Create Ticket
	freshdesk.createTicket(
		TicketObj,
		function (err, data) {
			
			// if error
			if (err) {
				res.status(200);
				return res.json({
					error: err,
					success:false,
					failedCreation:true,
					message: 'Ticket NOT created'
				});
			} // end if
			
			// Store Requester ID and Id of the created ticket for late consult
			// ...
							
			
			res.status(200);
			return res.json({
				error: false,
				data: data,
				success:true,
				message: 'Ticket created'
			});					
			
		}
	);

Anyone?

{ 'freshdesk-api': '2.4.0',
  npm: '5.5.1',
  http_parser: '2.7.0',
  icu: '58.2',
  modules: '48',
  node: '6.12.0',
  zlib: '1.2.11' }

provide stacktrace (if available)

createXXX methods fail

Every API creatng-method response with 201 status code.

Library checks the status, and it expects only 200 status..

Expose pagination from headers

Hey @arjunkomath, I was wondering if it's possible to also return/expose pagination details from
the headers and return an object instead of array like so:

{
  data: [
    { ... },
    { ... },
    { ... }
  ],
  per_page: 10,
  pages: 2,
  next_url: 'https://test.freshdesk.com/api/v2/tickets/?per_page=10&pages=2'
}

Add requestId even if the requset fail.

  • [ ] freshdesk-api V2

Current behavior

The extra arg only returns requestId iff the request is successful.

Expected behavior

Can you please add that requsetId even if the request fails since we need requestId only to trace the error.

The below screenshot is response header with requestId set by freshdesk in failed request.

Screenshot (7)
#68 #67

Validation error on getTicket

If do:
freshdesk.updateTicket(8, {description: "foo"}, cb);
all is fine, ticket gets updated and so on

but when I do:
freshdesk.getTicket(8, cb);

I get:

 name: 'FreshdeskError',
 message: 'Validation failed',
 data.errors[0] {
  "field": "ticket",
  "message": "Unexpected/invalid field in request",
  "code": "invalid_field"
}

I get similar if I try listAllTickets

I can make the calls through curl and HTTP.call without problems.

Strange.

Using with Webpack

Just a quick question, has anyone had any trouble using this package with webpack in use as well?

getAll* calls are misleading

  • freshdesk-api V2
  • freshdesk-api V1 (obsolete)

Current behavior

When calling an endpoint that will paginate it does not return ALL records - it returns only the records in the initial API response.

Expected behavior

Return ALL records via pagination.

More details

It seems this is already sort of considered:

// TODO: reconsider this property

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.