I need help with a request to get the list of all agents. What am I doing wrong?
app.js
let client;
init();
async function init() {
client = await app.initialized();
client.events.on('app.activated', loadAgents);
}
async function loadAgents() {
const params = await client.iparams.get();
const response = await client.request.invoke("get", {
url: `https://${params.domain}.freshdesk.com/api/v2/agents`,
headers: {
Authorization: "Basic " + btoa(params.api_key + ":X")
}
});
const agents = JSON.parse(response.response);
console.log(agents);
}
iparams.json
{
"api_key": {
"display_name": "api_key",
"description": "Please enter your api_key",
"type": "text",
"required": true,
"secure": true
},
"domain": {
"display_name": "domain",
"description": "Please enter your domain",
"type": "text",
"required": true
}
}
manifest.json
{
"platform-version": "3.0",
"modules": {
"common": {
"location": {
"full_page_app": {
"url": "index.html",
"icon": "styles/images/icon.svg"
}
},
"requests": {}
},
"support_ticket": {}
},
"engines": {
"node": "18.20.8",
"fdk": "9.7.4"
}
}```
