Created
June 21, 2017 14:06
-
-
Save willrnch/cdd84cc102390083bf45ffc23ca1ff7a to your computer and use it in GitHub Desktop.
Get freshdesk stats
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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