javascript [freshdesk节点] #customer
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript [freshdesk节点] #customer相关的知识,希望对你有一定的参考价值。
/*
https://github.com/arjunkomath/node-freshdesk-api
install: npm install --save freshdesk-api
*/
var Freshdesk = require('freshdesk-api')
var freshdesk = new Freshdesk('https://yourdomain.freshdesk.com', 'yourApiKey')
//with promises
var Promise = require('bluebird')
var asyncFreshdesk = Promise.promisifyAll(
new Freshdesk('https://yourdomain.freshdesk.com', 'yourApiKey')
);
/**------------------------------------------------
Ticket
*/
//Create a new ticket
freshdesk.createTicket({
name: 'test ticket',
email: 'test@test.com',
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)
})
/**-------------------------------------------------
Contacts
*/
//create new contact
freshdesk.createContact({
name: 'Contact 1',
email: 'test@test.com',
phone: '0123456789',
mobile: '0123456789',
twitter_id: 'twitter_id',
address: 'Address of the contact.',
description: 'A small description of the contact',
language: 'en'
}) , function (err, data) {
console.log(err || data)
};
//update contact
freshdesk.updateContact(21, {
name: 'Name 1'
}, function (err, data, extra) {
console.log(err || data)
});
//get contact
freshdesk.getContact(21, function (err, data, extra) {
console.log(err || data)
});
//delete a contact
freshdesk.deleteContact(21);
以上是关于javascript [freshdesk节点] #customer的主要内容,如果未能解决你的问题,请参考以下文章
php [freshdesk php core] freshdesk php api #customer
使用 Swift 2.2 中的 Freshdesk API
html [freshdesk jquery] #customer
从 SQL Server 触发器调用 Freshdesk API
php [freshdesk php]客户服务#customer
python [freshdesk - python]客户服务#customer