javascript [freshdesk节点核心] freshdesk nodejs纯#customer
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript [freshdesk节点核心] freshdesk nodejs纯#customer相关的知识,希望对你有一定的参考价值。
/*
Full: https://github.com/freshdesk/fresh-samples/blob/master/NodeJs
*/
//## create ticket
// npm install unirest
var unirest = require('unirest');
var API_KEY = "YOUR_API_KEY";
var FD_ENDPOINT = "YOUR_DOMAIN";
var PATH = "/api/v2/tickets";
var URL = "https://" + FD_ENDPOINT + ".freshdesk.com"+ PATH;
var fields = {
'email': 'email@yourdomain.com',
'subject': 'Ticket subject',
'description': 'Ticket description.',
'status': 2,
'priority': 1
}
var Request = unirest.post(URL);
Request.auth({
user: API_KEY,
pass: "X",
sendImmediately: true
})
.type('json')
.send(fields)
.end(function(response){
console.log(response.body)
console.log("Response Status : " + response.status)
if(response.status == 201){
console.log("Location Header : "+ response.headers['location'])
}
else{
console.log("X-Request-Id :" + response.headers['x-request-id']);
}
});
以上是关于javascript [freshdesk节点核心] freshdesk nodejs纯#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