https://github.com/kumarharsh/node-freshdesk
A nodejs library for integrating Freshdesk with your backend.
https://github.com/kumarharsh/node-freshdesk
Last synced: 4 months ago
JSON representation
A nodejs library for integrating Freshdesk with your backend.
- Host: GitHub
- URL: https://github.com/kumarharsh/node-freshdesk
- Owner: kumarharsh
- License: mit
- Created: 2015-02-17T14:06:28.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-01-05T19:08:37.000Z (over 9 years ago)
- Last Synced: 2025-10-07T17:56:21.020Z (9 months ago)
- Language: CoffeeScript
- Size: 15.6 KB
- Stars: 6
- Watchers: 1
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-freshdesk
**WARNING**
[](https://github.com/maxkoryukov/node-freshdesk-api/issues/1)
This repository and corresponding NPM package are deprecated in favor of [**freshdesk-api**](https://www.npmjs.com/package/freshdesk-api).
Useful links:
1. [NPM package](https://www.npmjs.com/package/freshdesk-api):
* v2 is **preferred**: `npm install freshdesk-api`
* v1: `npm install freshdesk-api@APIv1`
2. GitHub, `node-freshdesk-api`:
* [v2 on master branch](https://github.com/arjunkomath/node-freshdesk-api)
* [v1 in additional branch](https://github.com/arjunkomath/node-freshdesk-api/tree/API-v1)
----
A NodeJS library for integrating your backend with Freshdesk.
[](https://badge.fury.io/js/freshdesk)
# Install
```
npm install freshdesk
```
# Usage
You'll need your API Key and the base url of your support portal handy for configuring the SDK. To get your API key, refer the [Freshdesk Docs](http://freshdesk.com/api#authentication).
```
var _fd = require('freshdesk')
var Freshdesk = new _fd('http://mydomain.freshdesk.com', 'MyR4nD0MAp1KeY');
Freshdesk.listTickets(function(err, res, body) {
console.log("The tickets are: ", body);
});
```
# Supported Functions
Most of the functions pertaining **Tickets** and **Users** are implemented. For unimplemented routes, you can use the raw routes, such as `Freshdesk.get()` to make the requests directly.
Here are the currently supported functions. For a detailed explanation of the arguments you have to pass to each functions, refer to the [official docs](http://freshdesk.com/api).
* **createTicket** (data , cb )
method: post
url: `/helpdesk/tickets.json`,
* **listTickets** (cb )
method: get
url: `/helpdesk/tickets.json`
* **allTickets** (cb )
method: get
url: `/helpdesk/tickets/filter/all_tickets?format=json`
* **getTicket** (id , cb )
method: get
url: `/helpdesk/tickets/#{id}.json`
* **updateTicket** (id , cb )
method: put
url: `/helpdesk/tickets/#{id}.json`, data
* **pickTicket** (id , cb )
method: put
url: `/helpdesk/tickets/#{id}/pick_tickets.json`, {}
* **deleteTicket** (id , cb )
method: delete
url: `/helpdesk/tickets/#{id}.json`
* **restoreTicket** (id , cb )
method: put
url: `/helpdesk/tickets/#{id}/restore.json`
* **assignTicket** (id , user_id , cb )
method: put
url: `/helpdesk/tickets/#{id}/assign.json?responder_id=#{user_id}`
* **ticketFields** (cb )
method: get
url: `/ticket_fields.json`
* **addNoteToTicket** (id , note , cb )
method: post
url: `/helpdesk/tickets/#{id}/conversations/note.json`
* **createUser** (cb )
method: post
url: `/contacts.json`, contact
* **listUsers** (cb )
method: get
url: `/contacts.json`state=all'
* **updateUser** (id , cb )
method: put
url: `/contacts/#{id}.json`, data
* **getUserByEmail** (email_id , cb )
method: GET
url: `/contacts.json?state=all&query=#{query}`
# Examples
### Get a Particular Ticket
```
Freshdesk.pickTicket(100, function(err, res) {
console.log("My Ticket is", res.body);
});
```
### Create a New TIcket
```
var ticket = {
'helpdesk_ticket': {
'description': "Hello, I'm an ephemeral ticket created from the API. I will be deleted as soon as my creator wishes so...",
'subject': "Efemeros",
'email': 'efemeros@mailinator.com',
'priority': '1',
'status': '2',
'custom_field': {
// remove these comments, as they're not valid json
// any custom fields you'd have configured in your app...
// like:
// 'location_XXXXX': 'Tristan da Cunha'
// where XXXXX is a (possibly random) ID appended to your custom field
// This would most probably be different for each portal.
}
}
};
Freshdesk.createTicket(100, function(err, res) {
console.log("My Ticket is", res.body);
});
```
# Contributors
* Angad Nadkarni (@angadn) - Support for HTML tickets (#3)
* Scott Hasbrouck (@scotthasbrouck) - #1
* Martin Edwards (@mledwards) - #2
# Contributing
If you feel the need to add more functions, just fork this repo, add your functions and submit a PR. Wanna improve docs or the source, or even add tests? You're more than welcome :)
This is just a side project I created because I needed it, and the existing `node-freshdesk` [lacked some functions](https://github.com/capraconsulting/node-freshdesk/issues/2) which my project needed.