Skip to content

Instantly share code, notes, and snippets.

@willrnch
Created June 21, 2017 14:06
Show Gist options
  • Save willrnch/cdd84cc102390083bf45ffc23ca1ff7a to your computer and use it in GitHub Desktop.
Save willrnch/cdd84cc102390083bf45ffc23ca1ff7a to your computer and use it in GitHub Desktop.
Get freshdesk stats
const request = require('request-promise'); // npm install request request-promise
const API_KEY = '******';
request('https://bloomon.freshdesk.com/agents.json', {
headers: {
'Content-Type': 'application/json'
},
auth: {
user: API_KEY,
pass: 'X'
}
}).then((res) => {
const data = JSON.parse(res);
const availableAgent = data.reduce((accumulator, info) => {
return accumulator + (info.agent.available ? 1 : 0);
}, 0);
console.log(availableAgent);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment