Open huan opened 8 years ago
Hey, looks like you posted your API key.
Mike Kozak mkozak@meteormanaged.commailto:mkozak@meteormanaged.com
On Dec 17, 2015, at 7:25 AM, Zhuohuan LI notifications@github.com<mailto:notifications@github.com> wrote:
I had just wrote a easy to use OO wrapper: gas-freshdeskhttps://githubcom/zixia/gas-freshdesk/
looks like this:
var MyFreshdesk = new Freshdesk('https://mikebofreshdeskcom', 'Jrg0FQNzX3tzuHbiFjYQ')
var ticket = new MyFreshdeskTicket({ helpdesk_ticket: { description:'A description' , subject: 'A subject' , email: 'you@examplecom' } })
ticketassign(9000658396) ticketaddNote({ body: 'Hi tom, Still Angry' , private: true }) ticketsetPriority(2) ticketsetStatus(2)
ticketdel() ticketrestore()
Loggerlog('ticket #' + ticketgetId() + ' was set!')
hope it could useful and help others for easy start to api freshdesk
Reply to this email directly or view it on GitHubhttps://github.com/freshdesk/fresh-samples/issues/21.
@meteormanaged thanks for noticing me that. it's ok, because that key is from my testing account.
I created that account only for unit testing , and also make others to run the sample code easy.
var API_TOKEN = process.env.API_TOKEN;
var MyFreshdesk = new Freshdesk('https://mikebo.freshdesk.com', API_TOKEN);
i would suggest that it's poor practice to include your token in a script in practice, and better to present it as an environment variable (or though some other mechanism).
@meteormanaged
i agree with you. it's a poor practice. this is only for demo and example. (also used by my test cases).
if use a environment variable, it should looks like this (because it's in gas, not nodejs)
var API_TOKEY = PropertiesService.getScriptProperties().getProperty('FreshDeskApiToken')
@meteormanaged fixed as you suggest. :]
I had just wrote a easy to use OO wrapper: gas-freshdesk.
looks like this:
hope it could useful and help others for easy start to api freshdesk.